Why use "locals()"

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Sep 15 20:41:46 CEST 2009

En Tue, 15 Sep 2009 11:18:35 -0300, Sion Arrowsmith  
<sion at viridian.paintbox> escribió:
> Sean DiZazzo  <half.italian at gmail.com> wrote:

> What I'm not clear about is under what circumstances locals() does
> not produce the same result as vars() .

py> help(vars)
Help on built-in function vars in module __builtin__:

     vars([object]) -> dictionary

     Without arguments, equivalent to locals().
     With an argument, equivalent to object.__dict__.

Gabriel Genellina

More information about the Python-list mailing list