* Add Holger's new, well-received idea.

* Fixed typo.
This commit is contained in:
Raymond Hettinger 2003-02-12 01:38:25 +00:00
parent 85fb287b33
commit 578b6df698
1 changed files with 14 additions and 1 deletions

View File

@ -36,7 +36,7 @@ Proposal
(if <condition>: <expression1> else: <expression2>) (if <condition>: <expression1> else: <expression2>)
Note that the enclosing parethesis are not optional. Note that the enclosing parentheses are not optional.
The resulting expression is evaluated like this: The resulting expression is evaluated like this:
@ -83,6 +83,19 @@ Alternatives
--- ---
Holger Krekel proposed a new, minimally invasive variant:
<expression1> and <condition> else <expression2>
The concept behind it is that a nearly complete ternary operator
already exists with and/or and this proposal is the least invasive
change that makes it complete. Many respondants on the
newsgroup found this to be the most pleasing alternative.
However, a couple of respondants were able to post examples
that were mentally difficult to parse.
---
Many C-derived languages use this syntax: Many C-derived languages use this syntax:
<condition> ? <expression1> : <expression2> <condition> ? <expression1> : <expression2>