PEP 276 Simple Iterator for ints

Peter Hansen peter at
Thu Nov 29 01:10:12 CET 2001

James_Althoff at 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'

What am I missing here?  Is the above not just 
a far less sane way of writing the following?

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

Peter Hansen, P.Eng.
peter at

More information about the Python-list mailing list