Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4922
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!roy |
|---|---|
| From | Roy Smith <roy@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: dictionary size changed during iteration |
| Date | Sat, 07 May 2011 18:12:21 -0400 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 22 |
| Message-ID | <roy-4A30FD.18122007052011@news.panix.com> (permalink) |
| References | <4DAED72B.2030400@shopzeus.com> <mailman.644.1303306435.9059.python-list@python.org> <roy-FE896A.09154622042011@news.panix.com> <7xd3jukyn9.fsf@ruckus.brouhaha.com> |
| NNTP-Posting-Host | localhost |
| X-Trace | reader1.panix.com 1304806342 14791 127.0.0.1 (7 May 2011 22:12:22 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Sat, 7 May 2011 22:12:22 +0000 (UTC) |
| User-Agent | MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:4922 |
Show key headers only | View raw
In article <7xd3jukyn9.fsf@ruckus.brouhaha.com>, Paul Rubin <no.email@nospam.invalid> wrote: > Roy Smith <roy@panix.com> writes: > > changes = [ ] > > for key in d.iterkeys(): > > if is_bad(key): > > changes.append(key) > > changes = list(k for k in d if is_bad(k)) > > is a little bit more direct. This is true. I still file list comprehensions under "new fangled toys". While I use them, and appreciate their value, I admit they're not always the first thing that comes to my mind. OBTW, > changes = [k for k in d if is_bad(k)] is even more direct :-)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: dictionary size changed during iteration Peter Otten <__peter__@web.de> - 2011-04-20 15:33 +0200
Re: dictionary size changed during iteration Roy Smith <roy@panix.com> - 2011-04-22 09:15 -0400
Re: dictionary size changed during iteration Laszlo Nagy <gandalf@shopzeus.com> - 2011-05-06 18:21 +0200
Re: dictionary size changed during iteration Paul Rubin <no.email@nospam.invalid> - 2011-05-07 14:07 -0700
Re: dictionary size changed during iteration Roy Smith <roy@panix.com> - 2011-05-07 18:12 -0400
Re: dictionary size changed during iteration Hans Mulder <hansmu@xs4all.nl> - 2011-05-08 21:32 +0200
Re: dictionary size changed during iteration Paul Rubin <no.email@nospam.invalid> - 2011-05-08 12:42 -0700
csiph-web