On 08/08/18 16:55, Oscar Benjamin wrote:
Thinking about this some more: closing() can ensure finalisation but it is still generally bad to yield from a with block. Some context managers are designed to temporarily alter global state between __enter__ and __exit__ - this can be very confusing if you use them around a yield block.
Yes, but those sorts of context managers need to be used with care in all sorts of circumstances. Fiddling with global state is always fraught.
-- Rhodri James *-* Kynesim Ltd _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/