[Numpy-discussion] big picture?

Andrew P. Lentvorski bsder at allcaps.org
Thu Mar 7 02:31:04 CST 2002

On Thu, 7 Mar 2002, eric wrote:

>     1.  Matrix Multiply -- should we ask for ~*?
>     2.  Transpose -- In a perfect world, we'd have an operator for this.
>     3.  complex conjugate -- An operator for this would also be welcome

I, personally, don't find the arguments particularly compelling for extra
operators for numeric stuff.  While extra operators may make code more
"math-like", "MATLAB-like" or "Fortran-like", it won't help with
efficiency.  If I have code to compute A*x+B*y+C, I'm going to have to
call out the A*x+Z and Z=B*y+C primitives as functions anyway.  No set of
binary operators will work out that optimization.

Requesting domain specific operators actually scares me.  The main problem
is that it is *impossible* to remove them if your choices later turn out
to be confusing or wrong.  If operators must be added, I would rather see
a generic operator mechanism in place in Python.

Choice 1 would be a fixed set of operators getting allocated (~* ~+ ~-
etc.) which the core language *does not use*.  Then any domain can
override with their special meaning without collapsing the base language
under the weight of domain specific extensions.  Now the specific domains
can make their changes and only break their own users rather than the
Python community at large.

Choice 2 would be for a way for Python to actually adjust the
interpretation semantics and introduce new operators from inside code.
This is significantly trickier and more troublesome, but has the potential
of being a much more generally useful solution (far beyond the realm of
numerics).  Furthermore, it allows people to make code look like whatever
they choose.


More information about the Numpy-discussion mailing list