PEP 276 Simple Iterator for ints

Jeff Shannon jeff at ccvcorp.com
Thu Nov 15 17:10:44 EST 2001


David Eppstein wrote:

> In article <3BF40F8A.378CC6F8 at ccvcorp.com>,
>  Jeff Shannon <jeff at ccvcorp.com> 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
Technician/Programmer
Credit International





More information about the Python-list mailing list