[Python-Dev] nonlocal x = value
g.brandl at gmx.net
Mon Dec 27 15:01:16 CET 2010
Am 27.12.2010 10:43, schrieb Raymond Hettinger:
> FWIW, I'm entirely opposed to doing an assignment in a nonlocal definition.
> * It is easily mis-parsed by human (as shown by Georg's examples).
> * It looks very much like an initialization of a local variable in many languages,
> but it is not -- the variable has already been initialized in another scope.
Hah, and we'd probably get requests for a mandatory declaration of locals, ala
local a = 5
for reasons of "consistency" or "explicit is better than implicit".
More information about the Python-Dev