[Python-ideas] nonlocal functions

Jim Jewett jimjjewett at gmail.com
Thu Oct 22 16:06:06 CEST 2009


On Wed, Oct 21, 2009 at 8:47 AM, Masklinn <masklinn at masklinn.net> wrote:
>... I do think `let` fits the Zen better than
> nothing/`global`/`nonlocal`:
...
> instead of 3 different forms depending on the exact

Sure.

But that isn't the real choice.  The need to write to outer variables
is so rare that the vast majority of programs (let alone individual
functions) never use global or nonlocal.  So the real choice is
whether to type out the redundant `let` or to just let the compiler
infer it.  (Well, unless you wanted to change the rules for let
variables, to make deeper scoping and nesting more common.)

-jJ



More information about the Python-ideas mailing list