whos -- a function listing objects

benyang22 at yahoo.com benyang22 at yahoo.com
Thu Jun 16 14:57:52 EDT 2005


I have been a long time Matlab user. I Python, I miss Matlab's whos
command.

So I have written a little utility whos.py, which can be downloaded
here:
http://beluga.eos.ubc.ca/~tang/softwares/python/

Here is the doc string:

# Before using whos, do:
execfile('whos.py')

#=== EXAMPLES ===
# to see a list of all objects in the global scope
whos()

# to see a list of functions
whos('f')

# to see a list of variables (also their values)
whos('v')

# to see a list of Numeric array
whos('a')

# to see a list of variables in module os
import os
whos('v', module=os)

# to see a list of variables whose name contains 'path'
whos('v', sstr='path')

# to see a list of variables whose name contains 'path' (case
insensitive)
whos('v', sstr='path', casesen=0)

Argument what can be one of the following:
A -- all
a -- array
f -- function
m -- module
v -- variable




More information about the Python-list mailing list