Language design

Terry Reedy tjreedy at udel.edu
Thu Sep 12 14:46:21 EDT 2013


On 9/12/2013 2:24 PM, Markus Rother wrote:

> Dictionaries should iterate over their items instead of their keys.

Dictionaries *can* iterate by keys, values, or items. You would prefer 
that the default iteration be by items rather than keys.

> Looking forward to contrary opinions.

When the issue was discussed and decided, a majority of developers 
preferred keys. A large factor was experience and expectation that 
iterating by keys is more common than than iterating by items, coupled 
with the idea that the most common usage should be the default.

-- 
Terry Jan Reedy




More information about the Python-list mailing list