Dot product?
David C. Ullrich
ullrich at math.okstate.edu
Sun Dec 12 14:39:14 EST 1999
Berthold Höllmann wrote:
> "David C. Ullrich" <ullrich at math.okstate.edu> writes:
>
> > Ok, so I'm dense.
[...]
> How about:
>
> def Dot(X, Y):
> res = 0.
> for (x,y) in map(None, X, Y):
> res = res + x * y
> return res
Aha - I knew there must be something I was missing, thanks.
I would never guessed that that's what map(None, X, Y) would
do. Let's see... nope, I got no excuse, all explained clearly in the
docs under "map". I didn't realize that map could take more than
one parameter.
Exactly what I was hoping to find, thanks.
DU
More information about the Python-list
mailing list