[Numpy-discussion] how to get info about internals of an array object ?

Sebastian Haase haase at msg.ucsf.edu
Fri Sep 15 15:49:41 CDT 2006

On Friday 15 September 2006 12:49, Travis Oliphant wrote:
> Sebastian Haase wrote:
> >On Friday 15 September 2006 10:00, Travis Oliphant wrote:
> >>Sebastian Haase wrote:
> >>>Hi,
> >>>
> >>>what I'm asking is if numpy has an equivalent to numarray's info()
> >
> >function:
> >>>>>>na.arange(10).info()
> >>
> >>numpy.numarray.info(numpy.arange(10))
> >>
> >>(get recent SVN as there were some bugs just fixed.
> >>
> >>-Travis
> >
> >Thanks,
> >
> >should this maybe also be added somewhere in the numpy module itself !?
> >I guess the question is, what the original intent was for numarray to put
> > it in (only for debugging ?) -- then we could decide if this would also
> > make sense for numpy.
> >
> >I have never used numpy.info(obj) - I don't know what is does (compared to
> >__doc__)
> It prints the doc string of an object searching for it better than help
> seems to do and without a "pager".
> Compare numpy.info(numpy.sin) versus help(numpy.sin)
In PyShell I would miss the output of numpy.info(numpy.sin) since it goes to 
the (C) stdout and not to the (sometimes redirected ) python sys.stdout.
So it seems it prints N.sin.__doc__

The output from help(...) goes to the (python) sys.stdout (or stderr !?)  and 
is quite long (and mostly just generec info about ufuncs ...)

> I don't know what the info method was for other than debugging.
> What about having the __doc__ attribute of an ndarray return the info?
but honestly I would *not* expect any kind of "live inspection" to be done by 
I would expect more like 
"ndarray is an efficient way to handle large data sets in python - it is the 
bases for Numerical Python, see www.scipy.org "

Maybe info() should just be an array attribute - just like it was it numarray.


More information about the Numpy-discussion mailing list