PEP 276 Simple Iterator for ints

Jeff Shannon jeff at ccvcorp.com
Wed Nov 28 17:59:08 EST 2001


James_Althoff at i2.com wrote:

> And this might be handy in common situations where you could write, for
> example:
>
> if index not in len(mylist):
>     print 'index out of range'
>
> instead of
>
> if index not in xrange(len(mylist)):
>     print 'index out of range'

Better still, and already valid:

if index >= len(mylist):
    print 'index out of range'


The only place where this proposed feature applies, or would even be
particularly useful, is in the context of for-loop iteration.

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list