Fix w.r.t. exception tuples.
This commit is contained in:
parent
55027bb2f1
commit
dfbb060c4c
10
pep-3110.txt
10
pep-3110.txt
|
@ -83,7 +83,7 @@ to ::
|
|||
|
||||
The use of ``as`` in place of the comma token means that ::
|
||||
|
||||
except AttributeError, os.error:
|
||||
except (AttributeError, os.error):
|
||||
|
||||
can be clearly understood as a tuple of exception classes. This new
|
||||
syntax was first proposed by Greg Ewing [#firstproposal]_ and
|
||||
|
@ -93,6 +93,14 @@ Further, the restriction of the token following ``as`` from ``test``
|
|||
to ``NAME`` means that only valid identifiers can be used as
|
||||
``except`` targets.
|
||||
|
||||
Note that the grammar above always requires parenthesized tuples as
|
||||
exception clases. That way, the ambiguous ::
|
||||
|
||||
except A, B:
|
||||
|
||||
which would mean different things in Python 2.x and 3.x -- leading to
|
||||
hard-to-catch bugs -- cannot legally occur in 3.x code.
|
||||
|
||||
|
||||
Semantic Changes
|
||||
================
|
||||
|
|
Loading…
Reference in New Issue