4 Feb
2007
4 Feb
'07
7:22 p.m.
I have subclassed the numpy.ndarray object, but need some help setting some attributes. I have read http://scipy.org/Subclasses but it doesn't provide the answer I am looking for. I create an instance of the class in my __new__ method as: import numpy class MyClass(numpy.ndarray): __new__(self,…): # Some stuff here H, edges = numpy.histogramdd(…) return H This sets H as the instance of my object. I would also like to have edges be an attribute of MyClass. I can't do: self.edges = edges because the object hasn't been instantiated yet. Can someone show me how I can also keep the information from the variable edges? Thanks, Jeremy
6279
Age (days ago)
6282
Last active (days ago)
14 comments
6 participants
participants (6)
-
Jeremy Conlin
-
Pierre GM
-
Reggie Dugard
-
Stefan van der Walt
-
Sturla Molden
-
Travis Oliphant