Conditional operator in Python?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Thu Sep 6 13:25:04 EDT 2001
Tue, 04 Sep 2001 19:52:23 -0700, Erik Max Francis <max at alcyone.com> pisze:
>> if (X) Y else Z
>> which looks like statement if without colons (but parens are
>> required).
>
> I'm not comfortable with the required syntactic parentheses, since
> there's nothing else in the language like that.
What about:
if X: Y else: Z
There is no conceptual conflict with the statement if, because when
a statement can be understood in both ways, they have the same effect
anyway. I'm only not sure if it's easy to parse using current Python
parser.
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
More information about the Python-list
mailing list