PEP 276 Simple Iterator for ints (fwd)

Jeff Shannon jeff at ccvcorp.com
Fri Nov 16 01:05:25 CET 2001


Lulu of the Lotus-Eaters wrote:

> David Eppstein wrote:
> > You seem to be inconsistent here about whether  you want these ranges to be
> > open or closed on the right.  I think closed is the only reasonable
> > choice for this syntax.
>
> 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.
>
> Well, not the -only- case.  '[1,2,3,4,5]' looks like a closed interval
> to me... one whose ends are 1 and 5.

No, this is an explicit constant.  You're not asking anything to be interpolated,
therefor the interval idea doesn't really apply.  Currently, any time you ask
Python to give you "all the numbers from X to Y", it treats it as a half-open
interval.  Of course you can explicitly list each number that you want, but that's
a totally different procedure.

Jeff Shannon
Technician/Programmer
Credit International






More information about the Python-list mailing list