How do I access Python's dictionary of all global variables?
claird at lairds.com
Sat Feb 21 18:17:13 CET 2004
In article <c9d82136.0402210903.7cbf2335 at posting.google.com>,
Noah <noah at noah.org> wrote:
>I thought that Python has a builtin dictionary that associates
>global variable names with their values. I have forgotten how to do this and
>I can't seem to come up with the right search keywords to locate this secret
>again. I'm trying to write a global dynamic variable debugger sort of thing.
>So for example you could have code that looked something akin to this:
>>>> x = 5
>>>> y = "hello"
>>>> z = [1,2,3]
>>>> print __VARS__['x'], __VARS__['y'], __VARS__['z']
>x hello [1, 2, 3]
>Is it possible to iterate through all variables in all scopes in all objects?
Cameron Laird <claird at phaseit.net>
More information about the Python-list