Discussion: new operators for numerical computation

Greg Landrum glandrum at my-deja.com
Thu Jul 20 00:19:56 EDT 2000


>
> I can't see a good answer here. NumPy has been around for a long time
> and I believe it has a fairly large user base which is a strong
> argument in favor of the ".x" operators being matrixwise. However,
> other operators within python (*,+) operate "objectwise" on sequences
> (concatenation and replication). I think it would be suprising if
> these operators were elementwise for matrices and objectwise for
> other, similar, objects (sequences). This tends to favor ".x" being
> elementwise.
>

[apologies in advance for how rambling this is]

I'm just an ordinary NumPy user, but I know I'm not in favor of
any new syntax which is going to break my existing code (at least
until the mythical Py3K appears, at which point I'll probably just
suck it up and figure out how to make things go).  I have a lot of
Numeric code which is reliant upon * being elementwise, consequently
I have a major problem with that mysteriously changing.

I think Tim did a great job of summarizing that there aren't compelling
reasons pointing for either alternative syntax, so I think we should
at least try to obey the commandment:
Thou shalt not change syntax in ways which breaks existing code.

Of course, if it turns out that MatPy has a much larger user base than
Numeric Python (which I find unlikely), and * means "matrix
multiplication" then I will be sad for having made the wrong choice
two years ago and I'll have to undertake the enormously painful task
of updating most every piece of code I've written.

Can you detect my enthusiasm?

I, for one, find MatLab's syntax loathsome and don't really want to
have to use something that acts like it.  I also like the fact that
I have to explicitly type "matrixmultiply" to invoke an order-dependant
operation (since * is normally commutative).  I could live with .*
though.

Well, that's my view from the peanut gallery.

-greg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list