Add 'when' variant.
This commit is contained in:
parent
edf0585da8
commit
717ec38a5c
12
pep-0308.txt
12
pep-0308.txt
|
@ -153,6 +153,18 @@ Variations
|
|||
to several people. They all thought that if C was false, it would
|
||||
leave x unchanged. So don't even think about this one!
|
||||
|
||||
---
|
||||
|
||||
Another variant proposes to use 'when' instead of 'if':
|
||||
|
||||
<expression1> when <condition> else <expression2>
|
||||
|
||||
I don't see the advantage of 'when' over 'if'; it adds a new
|
||||
keyword which is a major extra hurdle to introduce this. I think
|
||||
that using a different keyword suggests that the semantics are
|
||||
different than those of an 'if' statement; but they really aren't
|
||||
(only the syntax is different).
|
||||
|
||||
|
||||
Copyright
|
||||
|
||||
|
|
Loading…
Reference in New Issue