[Python-3000] have iter(mapping) generate (key, value) pairs

Michael Chermside mcherm at mcherm.com
Fri Jun 2 23:30:05 CEST 2006


Steven Bethard writes:
> I'd like to suggest that we (at least briefly) re-consider the
> decision that iterating over a mapping generates the keys, not the
> (key, value) pairs.

I agree, now is the best time for reconsidering the decision.

My opinion on the matter itself is that I was unsure before we did
it, but that use has convinced me that iter() returning the keys
turns out to be very natural. Since I write "for x in myDict" a LOT
this outweighs any minor implementation details in dict() and
dict.update(). I say the original decision was a Python success
story: it's one of those examples that I look back on whenever my
confidence in Guido's intuition on syntax needs shoring up.

-- Michael Chermside



More information about the Python-3000 mailing list