On Mon, Nov 30, 2015 at 7:00 PM, Steven D'Aprano <st...@pearwood.info> wrote: > Either way, vars() doesn't solve the problem. What problem does it solve?
vars() used to be the way to list local variables. >From 4 May 1994, Python 1.0.2 [1]: vars() returns a dictionary containing the local variables; vars(m) returns a dictionary containing the variables of module m. Note: dir(x) is now equivalent to vars(x).keys(). >From 13 October 1995, Python 1.3 [2]: Two new built-in functions, "globals()" and "locals()", provide access to dictionaries containming [sic] current global and local variables, respectively. (These augment rather than replace "vars()", which returns the current local variables when called without an argument, and a module's global variables when called with an argument of type module.) [1]: https://hg.python.org/cpython/file/v1.3/Misc/HISTORY#l386 [2]: https://hg.python.org/cpython/file/v1.3/Misc/NEWS#l55 -- https://mail.python.org/mailman/listinfo/python-list