New submission from Nick Coghlan <ncogh...@gmail.com>: The current example for contextlib.contextmanager doesn't use try/finally, which sets folks up for writing resource management context managers that don't clean up after exceptions properly.
There's an example with try/finally down in the contextlib.closing docs, but I'm thinking it would be worthwhile to change the presentation of contextmanager itself. ---------- assignee: ncoghlan components: Documentation messages: 316416 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Add try-finally contextlib.contextmanager example type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33468> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com