view workspace, like in MatLab ?

Dave novin01 at gmail.com
Wed May 9 06:15:03 EDT 2007


Stef Mientki <S.Mientki-nospam <at> mailbox.kun.nl> writes:

> 
> hello,
> 
> is there a function / library / IDE that displays all the user defined 
> variables, like the workspace in MatLab ?
> 
> thanks,
> Stef Mientki

Using ipython (which I would highly recommend!) you can use the %whos 'magic'
function. This works as follows (with automagic (no % needed) on and pylab
imported):

In [1]: x = 10

In [2]: y = rand(3)

In [3]: z = 'astring'

In [4]: whos
Variable   Type       Data/Info
-------------------------------
x          int        10
y          ndarray    [ 0.57395635  0.92184657  0.16277339]
z          str        astring

In [5]: reset
Once deleted, variables cannot be recovered. Proceed (y/[n])?  y

In [6]: whos
Interactive namespace is empty.

In [7]:


Note: the %reset 'magic' function works like the Matlab clear all command.

HTH,
Dave




More information about the Python-list mailing list