I need to write this code
sorted(labeled_points,key=lambda (point, _): distance(point,new_point))
where distance is just Euclidean distance between vectors. The error message I receive is that it isn't possible in Python 3 - Sublist parameters are not supported in Python 3.x . I tried to replace it with this code
sorted(labeled_points,key=lambda point: distance(point,new_point))
but it seems this isn't working.
I also looked at examples and found that we can make do without lambda, we need to define function
def func(point,new_point):
return distance(point,new_point)
...
sorted(labeled_points,key=func(new_point))
But this does not seem to be evaluated. So,, how one could write this in Python 3?