On Mon, 26 Apr 2004 09:42:18 -0400, Peter Hansen <pe***@engcorp.com>

wrote:

Google Groups is always helpful for such questions:

http://groups.google.com/groups?q=in....lang.python.*

This leads to various threads, such as the "Re: Thoughts on PEP284"

which had the same proposal as yours and what is, I believe, an

adequate reason for rejecting it.

Thanx for the pointer, but I wasn't able to find a discussion

about the use of a "normal" range binary operator; I found

things like

for x in 0<= x < 10:

for x in 10:

for x in integers[0,1,...,10]:

for x in integers[0:10]:

I personally find all those forms not better than (x)range; the

first one looks a test, not a definition of an iteration and in

math it doesn't imply any order, the others are at least as

obscure to me as (x)range.

Something that would be very similar to what is used in math

is probably

for x in 1...10:

May be it's my math background, but I find things like

squares = [x*x for x in 1...100]

quite readable

And yes, I also used to write a lot of Pascal code so the ".."

is more natural to me (I've also to confess that I use PERL,

even if this probably means I'll be mailbombed from readers

of this NG ;-) ).

But in math three are used, and the three-dot ellipsis is

already present in Python (even if I've still to understand

what's used for); so asking by using the three-dot one

seemed more correct to me.

To me it's very strange that the "range operator" approach

hasn't been discussed at least as much as those other (IMO)

much more exotic ones. Is this because it would be like

admitting that there is something good in PERL too ? :-DDD

Sure this would leave open a few problems, like how to specify

the step (how about the BASIC "step" ? it shouldn't create

any syntax ambiguity, I suppose) but those using increments

different from +1 are already less "natural", and a more

convolute syntax (range ?) or an explicit "while" could be

acceptable anyway; looping using +1 and accessing by "[-i]"

or "[i*3]" may be is more readable (and is used often in math).

Ok... too much talking for a newbie, I'm back to reading :-)

Andrea

PS: Oh, by the way. Very funny the idea of allowing ++x

with the meaning it has in Python :-)