On Sat, Feb 8, 2020, at 18:06, Random832 wrote:
> My own expectation, for what it's worth, would be something like
[snip]

After thinking about it some more, I realized that my idea can basically be 
translated to "all with-expressions in the statement get added to an implicit 
ExitStack, which is then cleaned up after the statement."

> It's also tempting to try to define a way to, e.g. only include it in 
> scope for the evaluation of the condition in if statements and while 
> loops.

On further reflection, I don't think this is worth it in the general case - 
though the idea of a context manager being opened in each iteration of a while 
loop's condition not being closed until the end of the loop is concerning.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MYSSES3BOYG4XKW2UXLF5KRQM36LSVLF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to