[Numpy-discussion] Equivalent to IDL's help function

Aronne Merrelli aronne.merrelli at gmail.com
Mon Oct 7 14:38:53 EDT 2013


There isn't anything quite the same. (I think what you are really asking
for is a way to print the essential info about one variable name, at least
that is how I would use the IDL "help" procedure). In IPython, I use the
whos magic to do something similar, although it just prints this info for
all variables or all variables of one class, rather than just one variable.
I do not think there is a way to do it for just one variable.

Here are some examples - you can see this works quite well but it will
become unwieldy if your interactive namespace becomes large:

In [1]: x = 1; y = 2; z = 3.3; d = {'one':1, 'two':2, 'three':3}

In [2]: whos
Variable   Type     Data/Info
-----------------------------
d          dict     n=3
x          int      1
y          int      2
z          float    3.3

In [3]: whos dict
Variable   Type    Data/Info
----------------------------
d          dict    n=3

In [4]: xa = np.arange(111); ya = np.ones((22,4))

In [5]: whos ndarray
Variable   Type       Data/Info
-------------------------------
xa         ndarray    111: 111 elems, type `int64`, 888 bytes
ya         ndarray    22x4: 88 elems, type `float64`, 704 bytes




On Mon, Oct 7, 2013 at 12:15 PM, Siegfried Gonzi
<sgonzi at staffmail.ed.ac.uk>wrote:

> Hi all
>
> What is the equivalent to IDL its help function, e.g.
>
> ==
> IDL> a = make_array(23,23,)
>
> IDL> help,a
>
> will result in:
>
> A               FLOAT     = Array[23, 23]
>
> or
>
> IDL> a = create_struct('idl',23)
>
> IDL> help,a
>
> gives:
>
> A               STRUCT    = -> <Anonymous> Array[1]
>
> ==
>
> I have been looking for it ever since using numpy. It would make my life
> so much easier.
>
>
> Thanks, Siegfried
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20131007/cccb9996/attachment.html>


More information about the NumPy-Discussion mailing list