Raymond Hettinger added the comment:
FWIW, this is already easy to do with decorators:
>>> class Pass:
def __init__(self, exc):
self.exc = exc
def __enter__(self):
return self
def __exit__(self, exctype, excinst, exctb):
return exctype == self.exc
>>> with Pass(IndexError):
'hello'[10]
----------
nosy: +rhettinger
priority: normal -> low
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15804>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com