extend for loop syntax with if expr like listcomp&genexp ?
John Machin
sjmachin at lexicon.net
Mon Jul 11 20:12:33 EDT 2005
Bengt Richter wrote:
> E.g., so we could write
>
> for x in seq if x is not None:
Chundrous; looks like that p**l language ...
> print repr(x), "isn't None ;-)"
>
> instead of
>
> for x in (x for x in seq if x is not None):
Byzantine ...
> print repr(x), "isn't None ;-)"
>
> just a thought.
>
What's wrong with the following?
for x in seq:
if x is not None:
print repr(x), "isn't None ;-)"
More information about the Python-list
mailing list