
Hello,
On Sun, 29 Nov 2020 18:53:57 -0800 Christopher Barker pythonchb@gmail.com wrote:
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
What other language(s) implement such a scoping discipline? I know of none.
On the other hand, block-scoped variables are implemented in:
* C * C++ * Java * Rust * Lua * JavaScript (not by default, as opt-in) * Scheme * Common Lisp (as opt-in) * ML * Ocaml * Haskell * very long list of other languages...
The aim of the block scoping proposal is to make Python *not worse* than these other languages, instead of adding funny workarounds again.
[]