This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marienz
Recipients docs@python, eric.araujo, marienz
Date 2010-09-12.11:23:59
SpamBayes Score 6.663508e-09
Marked as misclassified No
Message-id <1284290643.1.0.683496424344.issue8652@psf.upfronthosting.co.za>
In-reply-to
Content
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? :)
History
Date User Action Args
2010-09-12 11:24:03marienzsetrecipients: + marienz, eric.araujo, docs@python
2010-09-12 11:24:03marienzsetmessageid: <1284290643.1.0.683496424344.issue8652@psf.upfronthosting.co.za>
2010-09-12 11:24:01marienzlinkissue8652 messages
2010-09-12 11:24:00marienzcreate