def sortPointsByXYDistance(self, points):
        """ Sort list of points by X+Y distance """

        distances = [(self.maze.calcXYDistance(point, self._end), point) for point in points]
        distances.sort()
            
        points2 = [item[1] for item in distances]

        return points2
 Sort list of points by X+Y distance 
recipes/Python/496884_Amaze__objectoriented_maze_generatorsolver/recipe-496884.py