27 Nov 2020 27 Nov '20
On Fri, 27 Nov 2020 21:21:48 +1100 Steven D'Aprano firstname.lastname@example.org wrote:
We can have too many scopes as well as too few:
a single process-wide global scope is too few;
every (sub-)expression being its own scope is too many;
so we're just arguing about where the Goldilocks Zone is. My argument is that it is *function scope*, with comprehensions considered to be an honorary function for that purpose.
So, the alternative opinion you hear is that we could allow *optional* block-level scoping. People who don't need it can continue to not have it. Nor it's supposed to be too-widely used feature. (Yeah, just the same as str.format(), annotations, f"", or dataclasses - all they should be strictly optional, adhoc-use features ;-) ).
-- Best regards, Paul mailto:email@example.com