PEP 276 Simple Iterator for ints (fwd)

Laura Creighton lac at strakt.com
Fri Nov 16 12:20:09 EST 2001


If you are going to be needing an index sequence a lot, what is so wrong
with this?

 import sys
 # a reusable index sequence, use with zip only, NOT with map
 _indices=xrange(sys.maxint)

 for i, old, new in zip(_indices, oldwidths, newwidths): #or whatever you want

 To the extent that this PEP is motivated by a desire to kill xrange, isn't
 this as good or better?  The PEP has other aims, I am well aware.

 Laura Creighton




More information about the Python-list mailing list