Any *disadvantage* to using xrange() instead of range()?

Bob Alexander bobalex at ix.netcom.com
Thu Jul 8 12:46:43 EDT 1999


...even for iteration over a small sequence of integers?

My intuition would be that xrange() is the preferred way to iterate over a
numeric sequence, but the documentation seems to go out of its way to stress
that the advantage of xrange() over range() is minimal -- almost seems to be
discouraging us programmers from using it unless we have a "memory-starved"
machine.

Is there any reason why xrange() should not be the "idiomatic" way to
iterate over a sequence of integers?

-- Bob





More information about the Python-list mailing list