[Python-3000] Default dict iterator should have been iteritems() (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 4 22:52:20 CEST 2007
- Previous message: [Python-3000] Default dict iterator should have been iteritems()
- Next message: [Python-3000] Default dict iterator should have been iteritems()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-3000] Default dict iterator should have been iteritems()
- Next message: [Python-3000] Default dict iterator should have been iteritems()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]