why in returns values for array and keys for dictionary

Terry Reedy tjreedy at udel.edu
Tue Aug 26 20:53:54 EDT 2008



Lie wrote:

> Anyway, there is two obvious choice when dealing with dictionary
> looping: return the keys and return the key and value.
 > The python designer thought...

The issue of whether there should be a default iterator and if so, which 
of the two obvious choices should be picked, was discussed on the py-dev 
list by several developers in addition to GvR.  'Yes, iterkeys' was the 
majority choice as the most useful for the most users.

The rationale for no default would have been 'explicit is better than 
implicit' and the easy prediction (proven true ;-) that either choice 
would be challenged.  Of course, no default would have been criticized 
also.

tjr




More information about the Python-list mailing list