An efficient way to sort complex numbers by their euclidean distances in Python
<p>I have several complex numbers that I need to sort by their euclidean distances. I solve this problem like this:</p>

<pre><code>            # A1x = Lowest Point (LP)
            # B1x = Point 1 (P1)
            # B4x = Point 2 (P2)

            C1 = euclidean(A1x, B1x) # Build the distance between LP and P1
            C4 = euclidean(A1x, B4x) # Build the distance between LP and P2

            array = np.array([C1, C4]) # Put the distances into an array...
            array.sort() # ...and sort it.

            # If the the distance between LP and P1 is the first element in the array
            # then take P1 as y_max value etc.

            if C1 == array[0]: 
                y_max = B1x

                if C4 == array[1]:
                    y_min = B4x

            if C4 == array[0]:
                y_max = B4x

                if C1 == array[1]:
                    y_min = B1x
</code></pre>

<p>This way works well for three or four points. However, now I got eight or nine points and the way as stated above gets a little bit nasty because I have to write the if conditions for every single point. Therefore, I would like to ask you if you know a better way to sort the complex numbers by their euclidean distances.    </p>