Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Robert Kern
Pierre GM wrote: > I agree that this one is not really informative. A a.__class__.__doc__? > provides a docstring interestingly truncated under ipython, but nothing > useful either. "a.__class__?" is the command that you are after, not "a.__class__.__doc__?". a.__class__.__doc__ is a strin

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Fernando Perez
On 1/5/07, Pierre GM <[EMAIL PROTECTED]> 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__ a

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Pierre GM
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

Re: [Numpy-discussion] ndarray newbie question

2007-01-05 Thread Robert Kern
belinda thom wrote: > Pierre, > > Thanks for the reply. > > > 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. > > dir? > obj.__doc__ ? > > When I try the latter recommendation abov

[Numpy-discussion] ndarray newbie question

2007-01-05 Thread belinda thom
Pierre, Thanks for the reply. > 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. dir? obj.__doc__ ? When I try the latter recommendation above w/numpy arrays, I get: In [1]: import num

Re: [Numpy-discussion] ndarray newbie question

2007-01-04 Thread Pierre GM
> > However, even record > > arrays don't have a keys() method. You can access the attributes of a recarray by N.ndarray.__getattribute__(obj,'dtype').fields which is yet another dictproxy. > Some context: the type of introspection I'm often wishing I could do > in a single, easy command usually

Re: [Numpy-discussion] ndarray newbie question

2007-01-04 Thread belinda thom
Vincent, Thanks again. On Jan 4, 2007, at 11:40 AM, Vincent Nijs wrote: > --b, > > The only data type in python that has a keys() method is a dictionary. Doh! > Unless it is a record array (http://www.scipy.org/RecordArrays) > there is no > information on variable names contained in the obje

Re: [Numpy-discussion] ndarray newbie question

2007-01-04 Thread Pierre GM
On Thursday 04 January 2007 14:18, belinda thom wrote: > Hello, > > I wrote a "display obj" method for viewing instance data: ... > and I'm wondering why it doesn't work on ndarrays: An (instance of) ndarray doesn't have a __dict__ attribute, as you've noticed. The class ndarray does have one.

Re: [Numpy-discussion] ndarray newbie question

2007-01-04 Thread Robert Kern
belinda thom wrote: > Hello, > > I wrote a "display obj" method for viewing instance data: > > def dobj(obj) : > """extended object viewer that displays arg""" > print 'Class: ', obj.__class__.__name__, ' id:', id(obj) > for k in obj.__dict__.keys() : > print ' ', k, ': '

Re: [Numpy-discussion] ndarray newbie question

2007-01-04 Thread Vincent Nijs
--b, The only data type in python that has a keys() method is a dictionary. Unless it is a record array (http://www.scipy.org/RecordArrays) there is no information on variable names contained in the object. However, even record arrays don't have a keys() method. Vincent On 1/4/07 1:18 PM, "b

[Numpy-discussion] ndarray newbie question

2007-01-04 Thread belinda thom
Hello, I wrote a "display obj" method for viewing instance data: def dobj(obj) : """extended object viewer that displays arg""" print 'Class: ', obj.__class__.__name__, ' id:', id(obj) for k in obj.__dict__.keys() : print ' ', k, ': ', obj.__dict__[k], ' id:', id(obj.__di