Diez B. Roggisch deets at
Mon May 1 19:17:56 CEST 2006

> and for short sequences, it doesn't really matter much in the 2.X series.
> it's definitely not "bad style" to use range instead of xrange for a ten
> to, say, 1000 item loop.

You and me are aware of that - but I figured the OP wasn't. And just the
other day somebody on wondered about the memory consumption of
his little script that contained a range(9000000) which he used for a loop.

And as in the case of a "for in" one can't even access the list produced by
range() and thus there is virtually no difference to xrange, I'd consider
it a code smell if it's used there  - why creating an object you don't use
when you can't even get a reference to it?


More information about the Python-list mailing list