4 ms·
Agreed. This example highlights the great savings of the [... _ ...] syntax in Arc (which I'd imagine is a fairly common use-case, especially for map, filter, e
by apu 18y ago
Agreed. This example highlights the great savings of the [... _ ...] syntax in Arc (which I'd imagine is a fairly common use-case, especially for map, filter, etc.).
Although ironically in this case, I'd probably use the following:
def vectorDotProduct(vector1, vector2):
return map(op.mul, vector1, vector2)
(where op has been imported previously using:
import operator as op
)
I'm not really sure how idiomatic this is, but I find that 90% of the time when I use map in python, it's with the operator module.