Iteration over two sequences

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jan 12 15:14:43 EST 2005

Henrik Holm wrote:
> John Lenton <jlenton at> wrote:
>>>def dotproduct(a, b):
>>>   psum = 0
>>>   for i in range(len(a)):
>>>       psum += a[i]*b[i]
>>>   return psum
>>for this particular example, the most pythonic way is to do nothing at
>>all, or, if you must call it dotproduct,
>>>>>from Numeric import dot as dotproduct
> Downloading, installing, and getting to know numerical modules for
> Python is mext on my list :).  However, I was under the impression that
> Numarray is preferred to Numeric -- is that correct?  Are these two
> competing packages?  (Hopefully this is not flame war bait...)
Numarray is the future, Numeric is the "past", but in the present
Numeric is better (and more mature) at some stuff than Numarray.

Learning both is not much harder than learning one, actually (they
share a lot).

--Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list