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. Is it because the class ndarray doesn't have an init method ? Dunno. Robert mentions it could be C related. Note that float(3), dict(a=3), list([3]) don't have __dict__ attributes either, when float, dict, and list do have one. You can still access the list of attributes an instance by dir, and a specific one by __getattribute__ for k in dir(obj): print k, obj.__getattr__(k) Or try to access the class of the instance to get the __dict__ for k in obj.__class__.__dict__.keys(): print k _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
