Python 'for' loop is memory inefficient
Terry Reedy
tjreedy at udel.edu
Mon Aug 17 23:56:58 EDT 2009
exarkun at twistedmatrix.com wrote:
> There's a lot of things in Python that I don't strictly *need*. That
> doesn't mean that they wouldn't be welcome if I could have them. Getting
> rid of the range/xrange dichotomy would improve things.
The developers agreed a couple of years ago. Starting using 3.1 if you
want this.
Since 'range' could refer to a user-defined object, rather than the
builtin function, there is no way the interpreter should substitute
'xrange'.
tjr
More information about the Python-list
mailing list