Steven D'Aprano wrote:
On Tue, 03 Nov 2009 22:43:45 -0600, Robert Kern wrote:
Or use the appropriate libraries:

from numpy import dot

scalar = dot(vec1, vec2)


Why would I want to use an already existing library that is fast, well-
written and well-supported, when I can toss together a nasty kludge myself?

because you want to perform a dot-product on strings?

  >>> dot_product(['a', 'b', 'c'], [2,3,4])
  'aabbbcccc'

[grins, ducks and scampers away after the sum-shouldn't-special-case-strings-with-an-error thread]

-tkc



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to