About generators
Peter Hansen
peter at engcorp.com
Mon Apr 26 09:42:18 EDT 2004
Andrea Griffini wrote:
> I'm new to python and I really like what I've seen so far
> with just one exception; the absence of a nice syntax
> for ranges of integers. I've read PEPs about allowing
>
> for i in 10:
> print i
>
> and I must say I don't like it very much, but I didn't
> find a discussion about what looks more natural
>
> for i in 0...9:
> print i
>
> or
>
> squares = [x*x for x in 1...100]
>
> that is having "expr1 ... expr2" returning an iterator
> from expr1 to expr2 (second limit included).
>
> Has this been considered ? If yes (as I suppose) where
> can I find and explanation about it ?
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.
-Peter
More information about the Python-list
mailing list