Status of PEP's?

James_Althoff at i2.com James_Althoff at i2.com
Fri Mar 1 19:23:55 EST 2002


[Jim]
> 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.

[David Eppstein]
> [x for 3 <= x < 10]

Agreed, the for+relational syntax works in list comp.s.  (Again, I was
lumping list comp.s in with for-loops).

I was thinking in a more general sense: I would like to create an iterator
with start, end, and step values and pass it into a function without first
actualizing it as a list (like one would have to do using for+relational in
conjunction with list comp.s).  And use the same construct in for-loops,
list comp.s, etc.  (For those just tuning in: I realize that I can create a
class for this -- actually, I already have.  I'm refering to proposals for
new idioms in Python for iterating intervals of integers.)

Jim





More information about the Python-list mailing list