A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-February/107907.html below:

[Python-Dev] [Python-checkins] r88331 - in python/branches/py3k/Doc/howto: index.rst pyporting.rst

[Python-Dev] [Python-checkins] r88331 - in python/branches/py3k/Doc/howto: index.rst pyporting.rst [Python-Dev] [Python-checkins] r88331 - in python/branches/py3k/Doc/howto: index.rst pyporting.rstSteven D'Aprano steve at pearwood.info
Fri Feb 4 00:32:20 CET 2011
Nick Coghlan wrote:
> On Fri, Feb 4, 2011 at 8:01 AM, brett.cannon <python-checkins at 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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4