<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 16.10.2016 09:35, Alireza Rafiei wrote:<br>
<blockquote
cite="mid:CAMX1E3vStopUF=jNRzXrt5dq79SW9QqvUzb9ZTcCMSJsAdwbSg@mail.gmail.com"
type="cite">
<div dir="ltr">Awesome! Thanks for the thorough explanation.</div>
</blockquote>
<br>
Indeed. I also didn't know about that detail of reversing. :)
Amazing. (Also welcome to the list, Alireza.)<br>
<br>
<blockquote
cite="mid:CAMX1E3vStopUF=jNRzXrt5dq79SW9QqvUzb9ZTcCMSJsAdwbSg@mail.gmail.com"
type="cite">
<div class="gmail_extra"><br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
def multisort(xs, specs):<br>
for key, reverse in reversed(specs):<br>
xs.sort(key=key, reverse=reverse)<br>
<br>
That's all it takes! And it accepts any number of items in
`specs`.<br>
Before you worry that it's "too slow", time it on real test
data.<br>
`.sort()` is pretty zippy, and this simple approach allows
using<br>
simple key functions. More importantly, it's much easier on
your<br>
brain ;-)<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
@Tim<br>
Do you think that simple solution could have a chance to be added to
stdlib somehow (with the possibility of speeding it up in the
future)?<br>
<br>
<br>
Regards,<br>
Sven<br>
</body>
</html>