[Numpy-discussion] Re: [Python-Dev] Re: Numeric life as I see it

Guido van Rossum gvanrossum at gmail.com
Wed Feb 9 20:37:06 CST 2005


[Paul]
> > Aside: While I am at it, let me reiterate what I have said to the
> > other developers privately: there is NO value to inheriting from the
> > array class. Don't try to achieve that capability if it costs
> > anything, even just effort, because it buys you nothing. Those of you
> > who keep remarking on this as if it would simply haven't thought it
> > through IMHO. It sounds so intellectually appealing that David Ascher
> > and I had a version of Numeric that almost did it before we realized
> > our folly.

[Travis]
> I appreciate some of what Paul is saying here, but I'm not fully
> convinced that this is still true with Python 2.2 and up new-style
> c-types.   The concerns seem to be over the fact that you have to
> re-implement everything in the sub-class because the base-class will
> always return one of its objects instead of a sub-class object.
> It seems to me, however,  that if the C methods use the object type
> alloc function when creating new objects then some of this problem is
> avoided (i.e. if the method is called with a sub-class type passed in,
> then a sub-class type gets set).

This would severely constrain the __new__ method of the subclass.

> Have you looked at how Python now allows sub-classing in C?  I'm not an
> expert here, but it seems like a lot of the problems you were discussing
> have been ameliorated.  There are probably still issues, but....
> 
> I will know more when I seen what happens with a Matrix Object
> inheriting from a Python C-array object.

And why would a Matrix need to inherit from a C-array? Wouldn't it
make more sense from an OO POV for the Matrix to *have* a C-array
without *being* one?

> I'm wondering if anyone else with more knowledge about new-style c-types
> could help here and show me the error of my thinking.

I'm trying...

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Numpy-discussion mailing list