equivalent to globals(), locals() for nonlocal variables?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Oct 22 02:21:49 EDT 2009


En Wed, 21 Oct 2009 16:06:31 -0300, geremy condra <debatem1 at gmail.com>  
escribió:

> I decided to play around with nonlocal declarations today, and was
> somewhat surprised when a call to nonlocals() resulted in 'nonlocals
> is not defined'. Is there an a standard equivalent to globals() or
> locals() for variables in outer nested scopes?

Not that I know of - and as someone pointed out recently, vars() should  
include those variables instead of simply returning locals().

-- 
Gabriel Genellina




More information about the Python-list mailing list