Giampaolo Rodola' added the comment: ExitStack() already covers the "null ctx mgr" use case described in the first message. Original example:
with transaction or contextlib.null(): ... By using ExitStack: with transaction or ExitStack(): ... You can push this further and do this, which is even more flexible: with ExitStack() as stack: if condition: stack.enter_context(transaction) ... So ExitStack really is better than the original proposal which could have made sense 6 years ago but not anymore. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10049> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com