[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Jan Kaliszewski zuo at chopin.edu.pl
Tue Sep 27 03:40:12 CEST 2011


Nick Coghlan dixit (2011-09-26, 11:01):

>   nonlocal VAR from EXPR    # Strongly indicates there's more than a

>   nonlocal EXPR as VAR    # Parser may struggle with this one

The construct itself appeals to me, but I share reservations against
using `nonlocal` for something used within the local lexical scope only.

I'd like to use `deflocal` keyword -- it'd be suggest something local
(in terms of scope), something constant (definition-time-related) and
something complementary to `nonlocal`.

    deflocal VAR from EXPR

-- would be perfect for me. But indeed -- that's a new keyword.

Regards.
*j




More information about the Python-ideas mailing list