Conditional iteration

Roberto Bonvallet Roberto.Bonvallet at cern.ch
Wed Dec 13 10:09:18 EST 2006


at wrote:
> More pythonic in view would be:
> 
> for x in [-2, -1, 0, 1, 2, 3, 4] if x > 0:
>        ... more code ...

Pythonic?  Do you realize that Python hasn't even adopted well-known
statements like 'switch' and 'do while' because they would be redundant?

This could be more convenient to you, but certainly not pythonic.
Cheers,
-- 
Roberto Bonvallet



More information about the Python-list mailing list