diff --git a/pep-0308.txt b/pep-0308.txt index f2b0529ca..d11404129 100644 --- a/pep-0308.txt +++ b/pep-0308.txt @@ -59,6 +59,15 @@ Proposal x if C else y, z <==> (x if C else y), z x, y if C else z <==> x, (y if C else z) + Note: a common way to emulate an if-then-else expression is: + + and or + + However, this doesn't work the same way: it returns + when is false! See FAQ 4.16 for alternatives that + work -- however, they are pretty ugly and require much more + effort to understand. + Alternatives @@ -66,15 +75,15 @@ Alternatives ? : - I reject this for several reasons: the colon already has many uses - in Python (even though it would actually not be ambiguous, because - the question mark requires a matching colon); for people not used - to C-derived language, it is hard to understand. + Eric Raymond even implemented this. I reject this for several + reasons: the colon already has many uses in Python (even though it + would actually not be ambiguous, because the question mark + requires a matching colon); for people not used to C-derived + language, it is hard to understand. --- - David Ascher proposed, and Eric Raymond even implemented, a - variant that doesn't have this problem: + David Ascher proposed a variant that doesn't have this problem: ? ! @@ -141,8 +150,8 @@ Variations x = e if C - to several people and they all thought that if C was false, it - would leave x unchanged. So don't even think about this one! + to several people. They all thought that if C was false, it would + leave x unchanged. So don't even think about this one! Copyright