PEP 276 Simple Iterator for ints

Jeff Shannon jeff at
Thu Nov 15 23:10:44 CET 2001

David Eppstein wrote:

> In article <3BF40F8A.378CC6F8 at>,
>  Jeff Shannon <jeff at> wrote:
> > Which is exactly why I think that the Haskell-ish syntax is a bad idea.  This
> > syntax cries out to be a closed interval, and it would be very confusing if
> > used as a half-open interval.  But that would make it the *only* case of
> > Python using a closed interval.  I find that inconsistency to be *far* more
> > jarring than the use of range().
> I don't buy this argument.  Currently AFAIK the *only* cases of Python
> using intervals at all are range() and xrange(),

No, Python also uses intervals in slicing notation--mylist[0:10] is a half-open
interval.  And slicing is very common.  And if you're using square brackets to
build a range in Haskell-ish, closed-interval style, as well as for slice notation,
then you're *really* asking for confusion.

Jeff Shannon
Credit International

More information about the Python-list mailing list