PEP 463: Few more markup fixes
HGe: Enter commit message. Lines beginning with 'HG:' are removed.
This commit is contained in:
parent
0d202d119b
commit
3baaf22f53
26
pep-0463.txt
26
pep-0463.txt
|
@ -752,23 +752,23 @@ LookupError, NameError, ZeroDivisionError). All of these were rejected,
|
|||
for several reasons.
|
||||
|
||||
* First and foremost, consistency with the statement form of try/except
|
||||
would be broken. Just as a list comprehension or ternary if expression
|
||||
can be explained by "breaking it out" into its vertical statement form,
|
||||
an expression-except should be able to be explained by a relatively
|
||||
mechanical translation into a near-equivalent statement. Any form of
|
||||
syntax common to both should therefore have the same semantics in each,
|
||||
and above all should not have the subtle difference of catching more in
|
||||
one than the other, as it will tend to attract unnoticed bugs.
|
||||
would be broken. Just as a list comprehension or ternary if expression
|
||||
can be explained by "breaking it out" into its vertical statement form,
|
||||
an expression-except should be able to be explained by a relatively
|
||||
mechanical translation into a near-equivalent statement. Any form of
|
||||
syntax common to both should therefore have the same semantics in each,
|
||||
and above all should not have the subtle difference of catching more in
|
||||
one than the other, as it will tend to attract unnoticed bugs.
|
||||
|
||||
* Secondly, the set of appropriate exceptions to catch would itself be
|
||||
a huge point of contention. It would be impossible to predict exactly
|
||||
which exceptions would "make sense" to be caught; why bless some of them
|
||||
with convenient syntax and not others?
|
||||
a huge point of contention. It would be impossible to predict exactly
|
||||
which exceptions would "make sense" to be caught; why bless some of them
|
||||
with convenient syntax and not others?
|
||||
|
||||
* And finally (this partly because the recommendation was that a bare
|
||||
except should be actively encouraged, once it was reduced to a "reasonable"
|
||||
set of exceptions), any situation where you catch an exception you don't
|
||||
expect to catch is an unnecessary bug magnet.
|
||||
except should be actively encouraged, once it was reduced to a "reasonable"
|
||||
set of exceptions), any situation where you catch an exception you don't
|
||||
expect to catch is an unnecessary bug magnet.
|
||||
|
||||
Consequently, the use of a bare 'except' is down to two possibilities:
|
||||
either it is syntactically forbidden in the expression form, or it is
|
||||
|
|
Loading…
Reference in New Issue