[Numpy-discussion] Numeric3
konrad.hinsen at laposte.net
konrad.hinsen at laposte.net
Mon Feb 7 11:41:16 EST 2005
On 07.02.2005, at 17:37, Ralf Juengling wrote:
> No, the idea behind using function calls rather than method calls
> is actually a little more than just a difference in syntax. It
> allows for a generic implementation that works in all cases of
> reasonable input, that is, it also works in cases where no efficient
> implementation is provided by the input object. A simple example:
True, but only due to the "add-on" character of arrays in Python. If
arrays had been part of the initial design, we would most certainly
have type promotion from lists to arrays in the same way as we have
type promotion from float to complex.
Note also that this approach is anything but modular or extendable. If
several modules went that way, they would not be interoperable (which
is in part the problem with the numpy/numarray split).
There is also a glaring hole in the OO approach in that there is no way
to add functionality (methods) to an existing object. The only solution
is subclassing, but then all object creators need to be changed to
those for the subclass, which is not practical. Unlike other OO
languages, Python makes it possible to add methods to existing classes,
but this always looks like a bad hack.
Konrad.
More information about the NumPy-Discussion
mailing list