Conditional operator in Python?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Fri Sep 7 15:29:09 EDT 2001


6 Sep 2001 17:25:04 GMT, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> pisze:

>     if X: Y else: Z
> 
> There is no conceptual conflict with the statement if, because when
> a statement can be understood in both ways,

Well, it can't. Statement 'if' is written as if 'else' started a
separate statement. I still don't know how the CPython's parser is
implemented and how easily it would deal with that, but each 'if'
is unambiguously either a statement or an expression. (The expression
variant must have an 'else'.)

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list