[issue10049] Add a "no-op" (null) context manager to contextlib

Nick Coghlan report at bugs.python.org
Fri Feb 10 14:58:30 CET 2012

Nick Coghlan <ncoghlan at gmail.com> added the comment:

FWIW, it's likely I'll be adding contextlib.ContextStack (see [1]) for 3.3. While it's far from the primary use case, that API also serves as a "no-op" context manager (if you never register any contexts or callbacks, the __exit__ impl does nothing).

[1] http://contextlib2.readthedocs.org/en/latest/index.html#contextlib2.ContextStack


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list