[Numpy-discussion] ndarray newbie question

Fernando Perez fperez.net at gmail.com
Fri Jan 5 04:02:34 CST 2007


On 1/5/07, Pierre GM <pgmdevlist at gmail.com> wrote:
> belinda thom wrote:
> > > Some context: the type of introspection I'm often wishing I could do
> > > in a single, easy command usually has to do w/getting to know the
> > > software better.
>
> For generic introspection in Python, dir and .__doc__ are very useful.
> The ? trick works in ipython and prints the __doc__.
>
> > When I try the latter recommendation above w/numpy arrays, I get:
> ...
> > Type:           NoneType
> > Base Class:     <type 'NoneType'>
> > String Form:    None
> > Namespace:      Interactive
> > Docstring:
> >      <no docstring>
>
> I agree that this one is not really informative. A
> >>> a.__class__.__doc__?
> provides a  docstring interestingly truncated under ipython, but nothing
> useful either.

You probably meant

In [4]: a.__class__?
Type:           type
Base Class:     <type 'type'>
Namespace:      Interactive
File:
/home/fperez/tmp/local/lib/python2.4/site-packages/numpy/__init__.py
Docstring:
    An array object represents a multidimensional, homogeneous array
    of fixed-size items.  An associated data-type-descriptor object
    details the data-type in an array (including byteorder and any
    fields).   etc...

Best,

f


More information about the Numpy-discussion mailing list