[Numpy-discussion] classmethods for ndarray
Fri Feb 2 02:41:57 CST 2007
On 2/1/07, Robert Kern <firstname.lastname@example.org> wrote:
> Christopher Barker wrote:
> > Sebastian Haase wrote:
> >> Could you explain what a possible downside of this would be !?
> >> It seems that if you don't need to refer to a specific "self" object
> >> that a class-method is what it should - is this not always right !?
> > Well, what these really are are alternate constructors. I don't think
> > I've seen class methods used that way, but then I haven't seen them used
> > much at all.
> Alternate constructors is probably the primary use case for class methods that
> I've seen. It's certainly the most frequent reason I've made them.
Same here (not in any publicly released code) and I happen to find
them handy in that role. Absent truly overloaded constructors à la
C++, they appear to be an acceptable compromise to me.
More information about the Numpy-discussion