Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51142 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2013-07-24 09:15 -0600 |
| Last post | 2013-07-24 09:15 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python 3: dict & dict.keys() Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-24 09:15 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2013-07-24 09:15 -0600 |
| Subject | Re: Python 3: dict & dict.keys() |
| Message-ID | <mailman.5044.1374678950.3114.python-list@python.org> |
On Wed, Jul 24, 2013 at 8:58 AM, Skip Montanaro <skip@pobox.com> wrote: >> What do you mean? Why would you want to create a temporary list just to >> iterate over it explicitly or implicitly (set, sorted, max,...)? > > Because while iterating over the keys, he might also want to add or > delete keys to/from the dict. You can't do that while iterating over > them in-place. None of the (set, sorted, max, ...) cases will add or delete keys while iterating. For the occasional for loop where the programmer does want to do that, you can still explicitly create a temporary list with list().
Back to top | Article view | comp.lang.python
csiph-web