[Python-3000] Default dict iterator should have been iteritems()

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 4 22:44:45 CEST 2007


Noam Raphael wrote:

> Just out of curiousity - do you remember these reasons?

I don't remember the discussion in detail, but a couple of
reasons that come to mind:

* It would be confusing to have "x in d" and "for x in d"
meaning subtly different things.

* It's more efficient to iterate over just the keys,
because a tuple has to be created for each item when
iterating over (key, value) pairs. It's reasonable
that if you want more done, you should have to write
more to get it.

--
Greg


More information about the Python-3000 mailing list