Get longest line from a set of four points

So I have a List of list of four curves.
Using Curve.PointAtParameter I get the mid points of these curves.

What I want to do is get the longest line from these set of 4 points >> meaning pick 2 points which will define the longest line.

My python skills are very basic and I can’t seem to get the nesting logic I feel which will solve this. Any help will be greatly appreciated. Thanks in advance.

I’d try the following logic:

Python’s itertools has a combinations function that you could use. You can sort a list curves by length by creating a lambda function and feeding it as a key to the sort function.


Thank you so much for this Dimitar :slight_smile: . Never really understood list combinations earlier but now it’s making sense. I also looked up stackoverflow and there were examples relating to itertools as mentioned by you. I have followed Corey Schafer’s youtube channel in which he has talked abt lambda functions. But as stated earlier, I am very much a beginner in python and need to practice more and be regular.