Why is Python popular, while Lisp and Scheme aren't?
Delaney, Timothy
tdelaney at avaya.com
Sat Nov 23 19:28:35 EST 2002
> From: Alexander Schmolck [mailto:a.schmolck at gmx.net]
>
> [Aside: the fact that for python dicts one iterates over keys
> rather than
> values seems like a wart to me, most likely caused by the
> absence of a set
> type (now in 2.3), and the consequent frequent abuse of dicts
> to represent
> sets. The resultant unnecessary discrepancy between the
> interfaces of mapping
> and sequence types is somewhat annoying.]
I OTOH fall firmly in the category of people who prefer 'for x in dict' to
iterate over the keys. In my own code I rarely use 'dict.values()', but very
often use 'dict.keys()'. I am more likely to use 'dict.items()' than
'dict.values()' and think this would have been the other logical choice for
iteration over a dict (i.e. returning key, value).
The most common case should be used for the shortest form.
Tim Delaney
More information about the Python-list
mailing list