With-Assignment statement

OK, I’m not sure what the point of using a string literal in a with statement is, but you’ve really thought about this.

Regarding “not cleaning up x afterwards”. Yes. Currently there’s no expectation that an indented with block creates a new scope. Allowances were made for list comprehensions, but in general introducing a new scope, where previously there was none, requires extraordinary supporting evidence, I feel. with statements are understood to be syntactic sugar for __enter__ and __exit__ methods in a try finally block. A very strong case is needed to change the way Python users can currently reason about their code.

Have you looked at rolling your own wrapper, that calls del on the new name in the with afterwards?