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

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


Nicholas Bastin wrote:
> On 9/4/07, Georg Brandl <g.brandl at gmx.net> wrote:
 >
> > Well, what about dict((x, d[x]) for x in d) ? Doesn't strike me as ugly...
> 
> It doesn't strike me as ugly, it just strikes me as slow.

Are people forgetting that in 3.0

   dict(d.items())

will do the same thing very efficiently?

Of course, if you know you have a dict, d.copy() is even
more efficient.

--
Greg


More information about the Python-3000 mailing list