Translate this to python?

Xavier Morel xavier.morel at masklinn.net
Wed Jan 4 11:39:29 EST 2006


pyguy2 at gmail.com wrote:
> For some reason, ocassionally when  I see xrange, I think "But wasn't
> that deprecated  since range is now a . . oh wait that's xreadlines".
> xrange is a  cool thing the few times where you really need it.
> 
> john
> 
>> Not sure what i is really for, but j seems to be independent,
>> so perhaps (also untested, and caveat: it's past bedtime)
>>
>> i = nPoints - 1
>> for j in xrange(nPoints):
>>     # whatever
>>     i = j
>>
>> Regards,
>> Bengt Richter
> 
I think that xrange is also soon-to-be deprecated (xrange eats a little 
less memory and is slightly faster to _create_, but much slower to 
_iterate over_ than range)



More information about the Python-list mailing list