PEP 308: Pep Update

Paul Svensson paul at svensson.org
Sat Mar 1 00:15:58 EST 2003


"Sean Ross" <sross at connectmail.carleton.ca> writes:

>"Lulu of the Lotus-Eaters" <mertz at gnosis.cx> wrote in message
>news:mailman.1046332734.23329.python-.
>>
>> In every Python construct that exists now, a condition is stated BEFORE
>> the actions that depend on it.
>>
>
>"Contrariwise", this is not true in 'every' Python construct:
>
>    seq = range(100)
>    evensquares = [x*x for x in seq if not x%2]
>
>So, 'The ternary form "x if C else y" [does not break] this uniformity',
>list comprehensions do.

Maybe if we used the term "condition comprehensions"
instead of ternary something, they would be easier to swallow...

+0	x if C else y
 0	no change
-0	x when C else Y
-1	the other proposals

		/Paul




More information about the Python-list mailing list