Conditional operator in Python?

Marcin 'Qrczak' Kowalczyk qrczak at
Tue Sep 4 18:01:04 CEST 2001

Tue, 04 Sep 2001 08:15:12 -0700, Erik Max Francis <max at> pisze:

>> I think (though it would need a bit of careful checking) that
>> there is no conflict with the existing Python syntax in making
>>         if <expr> then <expr> else <expr>
>> an expression.
>> Perhaps adding this to the syntax could be a PEP?
> That seems pretty reasonable to me.  I've been itching for
> a conditional operator in Python for quite some time.

The biggest problem is that 'then' is not currently a keyword.

(Or maybe a larger problem is opposition of some people which decide
or are respected in such issues...)

 __("<  Marcin Kowalczyk * qrczak at
  ^^                      SYGNATURA ZASTĘPCZA

More information about the Python-list mailing list