[Python-3000] Iterating over a dict

Terry Reedy tjreedy at udel.edu
Sat Apr 1 23:26:44 CEST 2006


"Thomas Lotze" <thomas.lotze at gmx.net> wrote in message 
news:pan.2006.04.01.12.32.19.172601 at gmx.net...
> The reason I ask this on the python-3000 list is that I wonder whether 
> the
> iterating behaviour of dicts might be changed in Python 3k, so that in 
> the
> above code, foo() would be applied to the dict's values.

Dicts give you the choice of iterating by keys, values, or items (key,value 
pairs).  Keys was chosen as the default after much discussion because it 
was most intuitive to more people and was expected to be the most common in 
usage.  I believe the choice has worked well enough for most people, so 
that there is no reason to gratuitously break existing code.  So I strongly 
suspect the answer is 'no'.

Terry Jan Reedy





More information about the Python-3000 mailing list