Feature suggestion: "Using declarations" i.e. context managers ("with" blocks) tied to scope/lifetime of the variable rather than to nesting

Rhodri James rhodri at kynesim.co.uk
Thu Feb 21 13:48:36 EST 2019


On 21/02/2019 18:35, mnl.post at gmail.com wrote:
> (I sent this a few days ago but got bounced without a reason—don’t see it
> posted, so I’m trying one more time.)

It was posted, and commented on.  You can see the thread in the mailing 
list archives, if you don't believe me: 
https://mail.python.org/pipermail/python-list/2019-February/739548.html

> I thought this new C# feature would be a good thing to add to Python:
> https://vcsjones.com/2019/01/30/csharp-8-using-declarations/
> 
> The nesting required by context managers can be at odds with a program’s
> real structure.

Really?  I thought in your example, particularly as revised here, the 
context managers showed up the real structure of the code nicely.

-- 
Rhodri James *-* Kynesim Ltd



More information about the Python-list mailing list