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.

Sometimes I have wished for an overloaded constructor, i.e.:

array(SomeBuffer)

results in the same thing as

frombuffer(SomeBuffer)


but Python doesn't really "do" overloaded methods, and there are some 
times when there wouldn't be only one way the input could be interpreted.

That all being the case, it seems to make some sense to put these in as 
class methods, but :

a = numpy.ndarray.fromfile(MyFile)

does feel a bit awkward.

Wx Python handles this by having a few constructors:

wx.EmptyBitmap()
wx.BitmapFromImage()
wx.BitmapFromBuffer()
etc...

but that's kind of clunky too.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to