number ranges

Alex Martelli aleaxit at yahoo.com
Tue Feb 21 00:47:53 EST 2006


Colin J. Williams <cjw at sympatico.ca> wrote:
   ...
> >>I am also open to such arguments but it will be tough to convince me
> >>that "x to y" should mean something different from what it means in
> >>Pascal, BASIC, and English.
   ...
> 1. Why not treat '2 to 5' or '(2 to 5)' as a semi-open interval?

Reread the part I quoted above: at least some of the proponents of this
syntax appear to be totally ignorant of 30 years of literature and
practice of programming, "it will be tough to convince" them that closed
intervals are a terrible mistake and semi-open ones the only way to go.
Introducing a new syntax, with semantics that "don't convince" some of
its prominent proponents, would be self-destructive (I shudder just to
think of the amount of time and energy we'd all be spending dealing with
whines about it); Python is clearly much better off if such people run
away to Ruby, with its (expletive deleted) a..b AND a...b syntaxes just
to ensure maximum confusion;-).

> 2. How could a stride be included in this notation?

The natural way would be (x to y by z), I think.


Alex



More information about the Python-list mailing list