Discussion: new operators for numerical computation

Warren B. Focke moron at Glue.umd.edu
Thu Jul 20 22:48:45 EDT 2000


(Huaiyu Zhu):
>Ah, I see where the problem is!  No.  Not a single line of
>code. (well, see below.) 
>
>For ordinary numbers, all the operators are exactly the same.
>
>For classes, they define their own __mul__ that is hooked to *.  This
>will not change, unless you choose to redefine __mul__.
>
>For the new operators, be it .* or @  or @*, they are not defined for
>anything other than numbers.  Each class is free to define them in any
>fashion.  

Under that proposal, sure.  But others have suggested changing the
meaning of the operators in NumPy.  I doubt that'll fly, which I think
is good.

>I see the eventual unification of MatPy and NumPy somewhat along the
>line of migration from the regex to re module.  That is, it would be
>possible in the future to define a new package with a different name,
>with an interface that has advantage of both, or better than both.
>People could just use the new package for new code, which could
>coexist with old modules as well.  They can migrate their code at
>leisure time.

The old code might not even have to coexist, the new package could
provide compatibility modules:

-------- Numeric.py --------------
from MumPy import *
frob_operators(...)
----------------------------------

and similarly for MatPy.

Warren Focke
-- 
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