dict.items() vs dict.iteritems and similar questions

Leif K-Brooks eurleif at ecritters.biz
Wed Mar 14 18:11:57 CET 2007

Laurent Pointal wrote:
> Both work, you may prefer xrange/iteritems for iteration on large
> collections, you may prefer range/items when processing of the result
> value explicitly need a list (ex. calculate its length) or when you are
> going to manipulate the original container in the loop.

xrange actually supports len():

  >>> len(xrange(10))

More information about the Python-list mailing list