About generators

Peter Hansen peter at engcorp.com
Mon Apr 26 19:47:27 EDT 2004


Andrea Griffini wrote:

> On Mon, 26 Apr 2004 09:42:18 -0400, Peter Hansen <peter at engcorp.com>
> wrote:
>>Google Groups is always helpful for such questions:
>>http://groups.google.com/groups?q=integer+range+syntax&meta=group%3Dcomp.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; 

You didn't read far enough.  The one I mentioned above is item
number 8 in the results from Google.  In it, Sean Ross had asked
about "for i in 0...10" and David Eppstein replies and points
out the key problem with it.

> Sure this would leave open a few problems, like how to specify
> the step (how about the BASIC "step" ? 

Yes, exactly the problem he pointed out.  He goes on to say
"If that's all the loop syntax can do, why not just keep the
current "for i in range(10):" syntax?
"Explicit is better than implicit."

And I agree with him.  Don't introduce extra syntax for trivial
gain...

-Peter



More information about the Python-list mailing list