Custom sorting in for loop
Maybe use a nested for loop with the outside one looking at the ith point.  then inside loop and calculate all the distances.  After calculation use a native python sort for that row and then add it to the main 2d array.
Let's say I am given an array of n points(pair of coordinates). I want to generate a 2D array of points, where ith row has all elements sorted according to their distance from the ith  point. There may be better and more efficient algorithms to get the final result, but for some reasons I want to do it by naive algorithm, i.e., brute-force. Also I don't want to write my own sorting function.
In C language, one can use the qsort function, but it's compare function only takes two parameters whereas I will be needing to pass three parameters: the reference point and two other points to be compared.
In Python too, one can use sorted function, but again, it's key function only takes one parameter, whereas in this case, I will need to pass two parameters.
So how do I do it?