string bug/oddity?
Richard Brodie
R.Brodie at rl.ac.uk
Mon Aug 13 08:50:12 EDT 2001
"Alex Martelli" <aleaxit at yahoo.com> wrote in message news:9l7tt9012o at enews2.newsguy.com...
> Simpler, yes. Not necessarily faster, and I was surprised when I
> actually measured iteration on .keys vs iteration on .items: the
> allocation/building of the N pairs may apparently take longer
> than the N [] indexing operations. Measure the two alternatives
> if you do need top speed at this point...
On a quick test with a large dictionary, items() was slowest. Using
iterators to avoid building the large list, iteritems() was fastest.
More information about the Python-list
mailing list