Status of PEP's?
Jeff Shannon
jeff at ccvcorp.com
Fri Mar 1 19:48:53 EST 2002
David Eppstein wrote:
> In article <mailman.1014944882.14890.python-list at python.org>,
> James_Althoff at i2.com wrote:
>
> > Another issue that I have is that the syntax does not work outside of a
> > for-loop header. I want to be able to create integer intervals anywhere in
> > my code, not just in the header of a for-loop.
>
> [x for 3 <= x < 10]
Personally, I still don't see this as being an advantage over xrange(3,10).
> or, for a slightly more complicated example: yesterday I wanted to iterate
> over powers of two:
>
> [1L << x for 0 <= x < 1000]
[1L << x for x in xrange(1000)]
While this would benefit from generator comprehension instead of list
comprehension, other than that, I don't (personally) see an advantage to the
interval-syntax proposal.
I suppose it's just a matter of taste, but I'd rather see fewer "nifty syntax
tricks" added to Python, and I don't see this as adding enough functionality over
xrange() to be worthwhile.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list