PEP 234: Iterators
tdickenson at devmail.geminidataloggers.co.uk
Tue May 1 12:35:15 CEST 2001
Guido van Rossum <guido at digicool.com> wrote:
> This means that we can write
> for k in dict: ...
> which is equivalent to, but much faster than
faster at runtime, and less typing too ;-)
> for k in dict.keys(): ...
> as long as the restriction on modifications to the dictionary
> (either by the loop or by another thread) are not violated.
What happens if you do violate this? I assume that damage is limited
to seing elements twice, or skipping some elements and not seeing them
tdickenson at geminidataloggers.com
More information about the Python-list