The normalization step, in which you divide pairwise distances by the maximum value, seems non-standard, and can make it difficult to find a ready-made function that will do what you need. It is quite easy, though to do it yourself. The starting point is turning your list_of_objects into an array:
>>> obj_arr = np.array(list_of_objects) >>> obj_arr.shape (3L, 4L)
Then you can get pairwise distances using broadcast transmission. This is a little inefficient because it does not use the symmetry of your metric and calculates each distance twice:
>>> dists = np.abs(obj_arr - obj_arr[:, None]) >>> dists.shape (3L, 3L, 4L)
Normalization is very simple:
>>> dists /= dists.max(axis=(0, 1))
And your final weighing can be done in various ways, you may want to test faster:
>>> dists.dot([1, 1, 1, 1]) array([[ 0. , 1.93813131, 2.21542674], [ 1.93813131, 0. , 3.84644195], [ 2.21542674, 3.84644195, 0. ]]) >>> np.einsum('ijk,k->ij', dists, [1, 1, 1, 1]) array([[ 0. , 1.93813131, 2.21542674], [ 1.93813131, 0. , 3.84644195], [ 2.21542674, 3.84644195, 0. ]])