On 16/11/19 4:30 am, Joao S. O. Bueno wrote:
Just add __enter__ and __exit__ to tuples themselves!

That wouldn't give the same result, though. E.g. if you're
using open(), a failure to open a later file in the list
should trigger the __exit__ of earlier ones. But using
a tuple, all the files have been opened before the with
statement gets a look in.

To get the right semantics, evaluation of the context
manager expressions needs to be under the control of
the with-statement.

--
Greg
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/IZJQAD3MXB5CHSZBWXZDO76B5E6DBM2N/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to