Raymond Hettinger added the comment: Yes, something along those lines would be *much* better:
class Ignore: ''' Context manager to ignore particular exceptions''' def __init__(self, *ignored_exceptions): self.ignored_exceptions = ignored_exceptions def __enter__(self): return self def __exit__(self, exctype, excinst, exctb): return exctype and issubclass(exctype, self.ignored_exceptions) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15806> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com