Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4964
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!news-out.octanews.net!indigo.octanews.net!auth.beige.octanews.com.POSTED!not-for-mail |
|---|---|
| From | Paul Rubin <no.email@nospam.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: dictionary size changed during iteration |
| References | <4DAED72B.2030400@shopzeus.com> <mailman.644.1303306435.9059.python-list@python.org> <roy-FE896A.09154622042011@news.panix.com> <7xd3jukyn9.fsf@ruckus.brouhaha.com> <roy-4A30FD.18122007052011@news.panix.com> <4dc6f077$0$41117$e4fe514c@news.xs4all.nl> |
| Date | Sun, 08 May 2011 12:42:23 -0700 |
| Message-ID | <7xhb952d40.fsf@ruckus.brouhaha.com> (permalink) |
| Organization | Nightsong/Fort GNOX |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:wJHOmhSoUpFM17EaSJ2UxvS2xTs= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Lines | 12 |
| NNTP-Posting-Date | 08 May 2011 14:42:23 CDT |
| X-Complaints-To | abuse@octanews.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:4964 |
Show key headers only | View raw
Hans Mulder <hansmu@xs4all.nl> writes:
> How about:
> changes = filter(is_bad, d)
> Or would that be too compact?
I thought of writing something like that but filter in python 3 creates
an iterator that would have the same issue of walking the dictionary
while the dictionary is mutating.
changes = list(filter(is_bad, d))
should work.
Back to comp.lang.python | Previous | Next — Previous 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