FW: [Python-Dev] conditional expressions?
Carel Fellinger
cfelling at iae.nl
Tue Oct 16 00:27:32 EDT 2001
Paul Rubin <phr-n2001d at nightsong.com> wrote:
> m.faassen at vet.uu.nl (Martijn Faassen) writes:
>> * list comprehensions are signalled by the fairly clear [ and ].
>> Conditional expressions use the already fairly strongly
>> overloaded ( and ). Of course I guess they wouldn't really
>> overload them further, but..
> A conditional expression analogy to list comprehensions would be
> x = (a if b else c)
though I think I like this spelling more, you mixed up a and b, and
that's probably a likely mistake, so a big disadvantage. On the other
hand this clearly looks like an expression to me, a big advantage.
> rather than
> x = if a then b else c
I've only once been exposed to Algol-60, to short to get familiar with
the use of a conditional statement disguised as an if *statement* but
I sure would like parens to be required in far more situations then
the current patch as it helps me to read it as an expression at a
glance. I think about the only place were I feel the extra parens
don't help is in a simple parameter list.
--
groetjes, carel
More information about the Python-list
mailing list