PEP 308: Discussion Summary

Denis S. Otkidach ods at
Wed Feb 19 17:55:36 CET 2003

On Wed, 19 Feb 2003, Raymond Hettinger wrote:

RH> * Someone re-proposed c ? a else b.  The rationale is that
RH> the ?
RH>    is a better marker than "then" and is suggestive enough
RH> to not
RH>    need a leading "if".  It doesn't require a new keyword
RH> and does
RH>    not overload the colon.  No one shot this down but it
RH> didn't
RH>    generate strong support either.
RH> * The "c then a else b" form was understood by most though a
RH> few
RH>    thought it looked unnatural in longer expressions.  There
RH> were some
RH>    who understood it but could not make the jump to the
RH> n-ary form
RH>    (using the elif keyword).  It appears that the colons
RH> help to visually
RH>    parse the n-ary form.

Can these forms be chained ("c1 then x else c2 then y else z";
"c1 ? x else c2 ? y else z")?

For me "c ? a : b", "c then a else b" and "c ? a else b" are the
most readable.

Denis S. Otkidach      [ru]

More information about the Python-list mailing list