What is the difference between 'except IOError as e:' and 'except IOError, e:'

Xavier Ho contact at xavierho.com
Tue Nov 17 21:33:43 EST 2009


On Wed, Nov 18, 2009 at 12:28 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

> I don't see any different between the following code in terms of
> output. Are they exactly the same ('as' v.s. ',')?
>

Yes, they're exactly the same. However, the syntax with "as" is newer,
introducted in Python 3.x, and eventually backported to 2.6. If you have
used Python 2.5, only the comma syntax would work.

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091118/dbda5997/attachment-0001.html>


More information about the Python-list mailing list