[Tutor] Fwd: iterating
Kent Johnson
kent37 at tds.net
Mon Apr 30 21:03:51 CEST 2007
Cecilia Alm wrote:
> 2007/4/30, Kent Johnson <kent37 at tds.net>:
> . Also if you are adding or deleting from the dict
>> during the iteration then dict.keys() is safer because the list of keys
>> is created before the add and delete.
>
> Thanks for the response; by adding and deleting, I assume you refer to
> adding or deleting keys (rather than changing the value associated
> with the key).
Right, I think changing a value will be safe.
Kent
More information about the Tutor
mailing list