On Sep 15, 11:41 am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote: > En Tue, 15 Sep 2009 11:18:35 -0300, Sion Arrowsmith > <s...@viridian.paintbox> escribió: > > > Sean DiZazzo <half.ital...@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(...) > vars([object]) -> dictionary > > Without arguments, equivalent to locals(). > With an argument, equivalent to object.__dict__.
Now *this* I would say is unPythonic: it's basically another obvious way to do something with no additional benefits. It'd be more useful (and less of a misnomer) if it would return an object really repesenting the variable visibility at the current scope, something like "globals().copy().update(locals())", while taking care of edge cases like undeclared locals. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list