Another conditional expression candidate (PEP 308)
Erik Max Francis
max at alcyone.com
Sun Feb 9 18:57:18 EST 2003
Evan wrote:
> x = (if a > 0: 'positive' elif a == 0: 'zero' else: 'negative')
>
> The parentheses and 'else:' clause are mandatory.
I suggested the same in these recent PEP threads as well.
> This has been proposed in the past ... and I can't find any specific
> objections to it, other than someone
> uncomfortable with the idea of mandatory parentheses.
In the recent threads, the main objection that seemed to be raised was
that of a general trend of expressionizing statements. Others also
expressed some displeasure at the required parentheses. I don't know if
that's really all that bad; the required brackets in list
comprehensions, for instance, are damn helpful in setting them off as in
"something special happens in here."
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ He who knows how to be poor knows everything.
\__/ Jules Michelet
Rules for Buh / http://www.alcyone.com/max/projects/cards/buh.html
The official rules to the betting card game, Buh.
More information about the Python-list
mailing list