Proposed PEP for a Conditional Expression

thp at thp at
Thu Sep 13 07:50:50 CEST 2001

Rainer Deyke <root at> wrote:
: "Terry Reedy" <tjreedy at> wrote in message
: news:OsUn7.4220$5A3.1585645 at
:> "Greg Ewing" <greg at> wrote in message
:> news:3BA00239.DECE6412 at
:> > "Terry Reedy" <tjreedy at>:
:> >
:> > > I agree that the above is backwards.
:> > > <cond> if <expr> else <expr>
:> >
:> > No! That sounds way too much like Forth!
:> It is exactly like C, whose ? : equivalent is the impetus for the
:> proposed change.
:> Of course, if you don't like the form of C's conditional expressions,
:> you won't like its translation into Python.

: C's syntax doesn't overload an already existing keyword, and is therefore
: arguably clearer.  None of the proposed keyword-overloading syntaxes mesh
: well with list comprehensions.

C syntax does overload the already heavily used colon.  Perhaps it
would be better to use semicolon instead of colon.

Tom Payne

More information about the Python-list mailing list