Proposal: add vector arithmetic to array module

Paul Rubin phr-n2001 at nightsong.com
Mon Sep 24 06:02:34 EDT 2001


Actually, the above suggestion of making the infix arithmetic
operators do pointwise arithmetic is no good, because of what happens
to "+".  It currently concatenates the arrays, similar to adding lists
together, and that shouldn't be messed up.

Next best thing is to just add array function calls:

array.add(a,b)  returns a new array a+b (pointwise addition)
array.add(a,b,c) stores the result in c and returns c (avoids
   allocating a new array)

Similarly for subtraction, multiplication, boolean operations, etc.




More information about the Python-list mailing list