<div dir="ltr">Hi,<br><br>I have a rather large list structure with tuples contained in them (it's part of a specification I received) looks like so: [(x1,y1,r1,d1),(x2,y2,r2,d2)...]<br><br>The list can range from about 800-1500 tuples in size and I'm currently sorting it with this:<br>
<br>a_list.sort(lambda a, b: cmp(b[3], a[3]))<br><br>I'm actually sorting it by the last value in the tuple (d2). I have been researching more efficient sorting algorithms and came across Schwartzian transform via these links:<br>
<ul><li><a href="http://www.biais.org/blog/index.php/2007/01/28/23-python-sorting-efficiency">http://www.biais.org/blog/index.php/2007/01/28/23-python-sorting-efficiency</a></li><li><a href="http://dev.fyicenter.com/Interview-Questions/Python/Can_you_do_a_Schwartzian_Transform_in_Python_.html">http://dev.fyicenter.com/Interview-Questions/Python/Can_you_do_a_Schwartzian_Transform_in_Python_.html</a></li>
</ul>I get what's happening (sorta...errr...lol)  but I'm not sure if it is more efficient in my scenario, if it is then I have no idea how to implement it properly :-/<br><br>Would be great if a true expert would offer a suggestion for me...<br>
<br>Thanks!<br><br>David<br></div>