ohms377 said:
Dear python users,
In interactive mode, I was wondering if there is a way to list all
declared variables and functions (and from global workspace).
In [1]: def foo(): pass
...:
In [2]: x=1
In [3]: a='hello'
In [4]: import re
In [5]: whos
Variable Type Data/Info
--------------------------------
a str hello
foo function <function foo at 0x403b725c>
re module <module 're' from '/usr/lib/python2.3/re.pyc'>
x int 1
In [6]: whos int
Variable Type Data/Info
----------------------------
x int 1
This is using ipython for the interactive work.
.
.
.
Fernando's IPython is indeed a great thing, one I often recommend.
I think you might want to know, though, that local and global heaps
are readily available even without it:
Python 2.3.5 (#2, Mar 26 2005, 17:32:32)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information. {'__builtins__': <module '__builtin__' (built-in)>, '__name__':
'__main__', '__doc__': None, 'a': 3}