Nick Coghlan wrote:
On Fri, Feb 4, 2011 at 8:01 AM, brett.cannon <python-check...@python.org> wrote:
+Capturing the Currently Raised Exception
+----------------------------------------
+One change between Python 2 and 3 that will require changing how you code is
+accessing the currently raised exception. In Python 2 the syntax to access the
+current exception is::
I think that the semantic change is *much* more important that the
syntax change.
In 2.6:
>>> try:
... len(None)
... except TypeError as e:
... pass
...
>>> e
TypeError("object of type 'NoneType' has no len()",)
In 3.1:
>>> try:
... len(None)
... except TypeError as e:
... pass
...
>>> e
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'e' is not defined
--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com