title: How to sum pairs of 2d arrays in list
body: <p>I need a good solution for summing up pairs of 2d vectors.</p>
  
  <p>I want to sum the distance between point1 and point2, point2 and point3... So this has to be done with all pairs (depending on the number of points)</p>
  
  <pre><code>a = np.array([[1, 1],[0, 0],[7, 9]])
  permutations = [((1, 1), (0, 0), (7, 9)), ((1, 1), (7, 9), (0, 0)), ((0, 0), (1, 1), (7, 9))] ....
  </code></pre>
  
  <p>Now after creating all possible permutations i want to sum the distances in order to specify which order is overall the shortest way.
  To get the distance between to points i use:</p>
  
  <pre><code>    def calcDistance(a, b):
          d = np.linalg.norm(a-b)
          return d
  </code></pre>
  
  <p>But i don't know how to apply this on a list to get the distance of every pair of points. I tried to do it with for-loops and slicing.</p>
  
  <pre><code>for i in range(0, len(permutations), 3):
      print(permutations[i:i+3])
  </code></pre>
  
  <p>As a test it worked, but i have no idea how to apply the calc function on every pair in a list and sum this up again to get a total distance.
  The permutations are all stored in one list, so my idea was to go over the n-elements (number of points/vectors) for each iteration.</p>