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 ezio.melotti
Recipients alex, chris.jerdonek, cvrebert, ezio.melotti, loewis, ncoghlan, rhettinger
Date 2012-08-29.10:06:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346234820.07.0.190853043122.issue15806@psf.upfronthosting.co.za>
In-reply-to
Content
> As with many context managers, a key benefit here is 
> in the priming effect for readers.

The "focus" is mostly on what it's being executed rather than what it's being ignored though.

"Do this operation and ignore these exceptions if they occur"
vs.
"Ignore these exceptions if they occur while doing this operation."

> I'm not worried that it makes things less explicit - it's pretty
> obvious what a context manager called "ignored" that accepts an
> arbitrary number of exceptions is going to do.

It's still understandable, but while I'm familiar with the semantics of try/except, I wouldn't be sure if e.g. this just ignored those specific exceptions or even their subclasses without checking the doc/code.

> One other thing it does is interact well with ExitStack - you can
> stick this in the stack of exit callbacks to suppress exceptions that
> you don't want to propagate.

This seems a good use case.
History
Date User Action Args
2012-08-29 10:07:00ezio.melottisetrecipients: + ezio.melotti, loewis, rhettinger, ncoghlan, alex, cvrebert, chris.jerdonek
2012-08-29 10:07:00ezio.melottisetmessageid: <1346234820.07.0.190853043122.issue15806@psf.upfronthosting.co.za>
2012-08-29 10:06:59ezio.melottilinkissue15806 messages
2012-08-29 10:06:58ezio.melotticreate