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

"Martin v. Löwis" martin at v.loewis.de
Tue Sep 4 17:01:07 CEST 2007


> (assuming d[x] is  O(log n))

In Python, d[x] is typically considered to be O(1) (unlike in C++,
where it is O(log n)). Of course, with Python using a hashtable,
performance may decrease in the presence of collisions. In the
normal case, dict((x, d[x]) for x in d) will be O(n) in Python.

Regards,
Martin


More information about the Python-3000 mailing list