On Sat, Feb 8, 2020, at 18:06, Random832 wrote:
My own expectation, for what it's worth, would be something like
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.