[Python-checkins] r66834 - peps/trunk/pep-3110.txt
georg.brandl
python-checkins at python.org
Tue Oct 7 18:04:41 CEST 2008
Author: georg.brandl
Date: Tue Oct 7 18:04:41 2008
New Revision: 66834
Log:
Fix w.r.t. exception tuples.
Modified:
peps/trunk/pep-3110.txt
Modified: peps/trunk/pep-3110.txt
==============================================================================
--- peps/trunk/pep-3110.txt (original)
+++ peps/trunk/pep-3110.txt Tue Oct 7 18:04:41 2008
@@ -83,7 +83,7 @@
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 @@
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
================
More information about the Python-checkins
mailing list