[issue10049] Add a "no-op" (null) context manager to contextlib
Martin Blais
report at bugs.python.org
Fri Nov 18 17:59:00 EST 2016
Martin Blais added the comment:
I've been looking for this today; I would have used it.
Instead of an obvious (and explicit) null context manager, I had to read through this entire thread to eventually find out that I can use something called ExitStack(), which is designed for another use case.
When many users have to replicate the same boilerplate code time and time again, it's not cruft, it's just something that ought to be part of the stdlib. There are a number of such cases in the stdlib. I think nullcontext should be part of the included batteries Python aims to provide.
----------
nosy: +Martin Blais
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10049>
_______________________________________
More information about the Python-bugs-list
mailing list