at <[EMAIL PROTECTED]> writes:
> You proposal, seems nice to me but it doesn't work with Python 2.4.3, should
> it work with 2.5?
> 
> Again I am just wondering if the approach for 
> 
>         [x for c x in some_list if some_condition]
> 
> and
>         x = a if b else c
> 
> could be generalized for normal straight forward iterations:
> 
> for x in some_list if some_condition:

Sorry, I got it wrong.  Should have said:

   for x in (x for x in some_list if some_condition): 
          ...

So your example would have been:

  for x in (x for x in [-2, -1, 0, 1, 2, 3, 4] if x > 0):
       ... more code ...

It should work in 2.4.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to