[Numpy-discussion] ndarray newbie question
bthom at cs.hmc.edu
Thu Jan 4 14:18:39 EST 2007
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.__dict__
and I'm wondering why it doesn't work on ndarrays:
>>> m = numpy.zeros(3)
AttributeError: 'numpy.ndarray' object has no attribute '__dict__'
I am also fairly new to python, but would have thought all objects
had dictionaries, especially when they are comprised of other things,
produces a slew of components, e.g.
tofile, ..., transpose, ..., view, etc.
Thanks for any insight.
More information about the NumPy-Discussion