homepage

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 ncoghlan
Recipients alex, ncoghlan, rhettinger
Date 2012年08月29日.06:20:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346221249.34.0.835780678858.issue15806@psf.upfronthosting.co.za>
In-reply-to
Content
I'd just write it with @contextmanager. Making it easier to cleanly factor out exception handling is one of the main reasons that exists.
 @contextmanager
 def ignored(*exceptions):
 """Context manager to ignore particular exceptions"""
 try:
 yield
 except exceptions:
 pass
While the class based version would likely be fractionally faster, the generator based version is more obviously correct.
History
Date User Action Args
2012年08月29日 06:20:49ncoghlansetrecipients: + ncoghlan, rhettinger, alex
2012年08月29日 06:20:49ncoghlansetmessageid: <1346221249.34.0.835780678858.issue15806@psf.upfronthosting.co.za>
2012年08月29日 06:20:48ncoghlanlinkissue15806 messages
2012年08月29日 06:20:48ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /