Hello,
I’m trying to project points on 4 curves then remove the farthest point.
I wrote this:
Why is list not callable? how do I sort a list of points per distance?
Hello,
I’m trying to project points on 4 curves then remove the farthest point.
I wrote this:
Why is list not callable? how do I sort a list of points per distance?
Hi,
I believe the key
argument of sort()
expects a function, not a list.
Alternatively, you could sort your P1
list with the values of D1
like so:
sorted_pts = [pt for _, pt in sorted(zip(D1, P1), reverse=True)]
To sort your list with key you would need to define a function eg myfunc
which takes a single argument: a point from the list, and returns the distance and use key=myfunc
.
Graham
Thanks everyone that was super helpful! I was using sort like the grasshopper component