Discussion: new operators for numerical computation

Warren B. Focke moron at Glue.umd.edu
Fri Jul 21 20:29:35 EDT 2000


>>The old code might not even have to coexist, the new package could
>>provide compatibility modules:
>
>Interesting. Details?

I'll admit I had not thought hard about this before posting - that's
why I said "might".  In the current implementation of NumPy, in which
arrays are a type rather than a class, and thus cannot be subclassed
nor have their methods reassigned, it probably wouldn't work like I
implied.

But we aren't discussing the current implementation.  So we could have
a common base type which included all of the operations, then

------- Numeric.py ----------
class array:
	from array_base import *

	__mul__ = mul_elementwise

	__add__ = add_broadcasting
#or maybe
	__add__ = lambda self, other, dest: add(self, other, dest, broadcast=1)
#and so on.
------------------------------

Not sure whether the rumored future type/class healing would make this
simpler.

And while we're pondering reimplementaions, it might be cool to move
as much non-performance-critical code as feasible up into a Python
layer to ease synchronization between [C/J/IL?/???]Numeric.  The top
layer would be shared, and only the core would be in whichever
low-level language.

Then again, maybe I'm biting off more than my brain can chew on a
Friday afternoon.

WBF

-- 
If you feel that you have both feet planted on level ground, then the
university has failed you. -Robert Goheen, President, Princeton University



More information about the Python-list mailing list