finding euclidean distance,better code?

Gabriel Genellina gagsl-py2 at
Sat Mar 29 00:18:46 CET 2008

En Fri, 28 Mar 2008 18:15:04 -0300, harryos <oswald.harry at>  

> if i were to calculate the euclidean distance in the above example how
> should i go about it..?
> should i replace
> distance = abs(input_wk - weights[image, :])
> with something else?

For a single 2D vector, math.hypot does what you want. But the above looks  
like a NumPy array; see this thread

Gabriel Genellina

More information about the Python-list mailing list