PEP 308: "then" "else" for deprecating "and" "or" side effect s

sismex01 at hebmex.com sismex01 at hebmex.com
Fri Feb 14 10:10:50 EST 2003


Note: The condition is worded as "OK" to mean that
it's checking the "ok condition", and "NOK" when it's
checking for an exceptional condition.

"a" is the "ok" value, and "b" is the "nok" value.

Summary of simple syntaxes:

* Guido's original suggestion: "a" if OK else "b"
  but some noisy people didn't
  like it's reverse parsing.

* Christian Tismer champions:  OK then "a" else "b"
  as his preferred syntax.

* François Pinard mentions:    "a" when OK else "b"
  as his own, evolved from a
  language of his design.

I agree with Harvey Thomas, there will be a need to
create a new keyword if any of the more simpler
alternatives are taken.

Also, worth repeating, is that these are not "operators"
in the traditional Python sense, but syntactical
constructs, so it's essential not to use them in the
same context, nor confuse them.

Any of these three get's a +1 from me.

Good day and have a commercially happy Feb 14th :-P

:-)

-gus





More information about the Python-list mailing list