This is a massively less ambitious idea, and doesn't solve the original problem, but:
I'd like to see a scope for names that are "obviously ;-)" meant to be short lived. At the moment that's the for loop "counters" and those created by context managers:
for i in something:
# use i as usual
more_code
# now i is not defined
This would be a lot like comprehensions, and for the same reasons (though less compelling)
And:
with something as a_name:
# use a_name here
more_code
# a_name is not defined.
This just plain makes "natural" sense to me -- a context manager creates, well, a context. Various cleanup is done at the end of the block. The variable was created specifically for that context. It's really pretty odd that it hangs around after the context manager is done -- deleting that name would seem a natural part of the cleanup a context manager does. This one seems more compelling than the for loop example.
Consider probably the most commonly used context manager:
with open(a_path, 'w') as output_file:
output_file.write(some-stuff)
# whatever else
now we have a closed, useless, file object hanging around -- all keeping that name around does is keep that file object from being freed.
The challenge, of course, is that this would be a backward incompatible change. I don't think it would break much code (though a lot more for for than with) but maybe it could be enabled with a __future__ import.
In any case, I would much rather have to opt-in to keep that variable around than opt out with an extra let or something.
-CHB