PEP 276 Simple Iterator for ints

James_Althoff at James_Althoff at
Thu Nov 29 03:18:43 CET 2001

Peter Hansen wrote:
>Or just:
>if not 0 <= index < len(mylist):
>    print 'index out of range'

Right.  Which has the added advantage of not repeating index.

Or just, just:

    if not index in len(mylist):  # I know, I'm going around in circles


More information about the Python-list mailing list