Marien Zwart <[email protected]> added the comment:
Sorry for forgetting about this for so long.
The attached patch makes the following changes:
Removes the two instances I noticed of treating exception instances as
sequences. This no longer works in python 3 and is not very useful in python 2,
so best avoided.
Adds a warning explaining ``except FooException, BarException:`` does not do
what you might think. I think this is a good warning to have (because you *can*
omit those parens in many other places) and it mentions the pre-python 2.6
syntax for "as" by side effect.
There are two things I'm not entirely happy about:
I initially wrote ``print "I/O error({0.errno}): {0.strerror}".format(e)``, but
then noticed this string formatting trick is not mentioned in the previous
chapter of the tutorial. Dict access (``"{0[foo]}".format(d)``) is, but
attribute access is not. Is this worth adding to that chapter, so it can be
used here?
Binding an exception instance to a variable (using "as") is explained near the
bottom of the section on catching exceptions, well before it is used. Perhaps
this could do with a bit of reordering? I felt it better to keep my initial
patch more minimal though.
Comments? :)
----------
keywords: +patch
Added file: http://bugs.python.org/file18857/errors.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue8652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com