Explain that "e if C" (without the "else" part) is a bad idea.
This commit is contained in:
parent
63a04aad2b
commit
648a2a5acc
12
pep-0308.txt
12
pep-0308.txt
|
@ -110,6 +110,18 @@ Alternatives
|
|||
is called. There's no way to short-circuit the expression
|
||||
evaluation.
|
||||
|
||||
|
||||
Variations
|
||||
|
||||
It has been proposed to make the 'else' part optional. This would
|
||||
be a really bad idea. I showed:
|
||||
|
||||
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!
|
||||
|
||||
|
||||
Copyright
|
||||
|
||||
This document has been placed in the public domain.
|
||||
|
|
Loading…
Reference in New Issue