<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><blockquote type="cite"><div><blockquote type="cite">ISTM, the performance would be about the same as you already get from attrgetter(), itemgetter(), and methodcaller().  Also, those three tools are already more flexible than the proposal, for example:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> attrgetter('lastname', 'firstname')  # key = lambda r: (r.lastname, r.firstname)<br></blockquote><blockquote type="cite"> itemgetter(0, 7)                     # key = lambda r: (r[0], r[7])<br></blockquote><blockquote type="cite"> methodcaller('get_stats', 'size')    # key = lambda r: r.get_stats('size')<br></blockquote><br>It is easy to not know about these.</div></blockquote><div><br></div><div>FWIW, those and other sorting related topics are covered in the sorting-howto:</div><div><a href="http://wiki.python.org/moin/HowTo/Sorting/">http://wiki.python.org/moin/HowTo/Sorting/</a></div><div><br></div><div>We link to that from the main docs for sorted():</div><div><a href="http://docs.python.org/library/functions.html#sorted">http://docs.python.org/library/functions.html#sorted</a></div><div><br></div><div><a href="http://docs.python.org/library/functions.html#sorted"></a></div><div><br></div><blockquote type="cite"><div> I think the doc set could usefully use an expanded entry on *key functions* </div></blockquote><div><br></div><div>That might also make a useful entry to the glossary.</div><div><br></div><div><br></div><div>Raymond</div><div><br></div><div><br></div><div>P.S.   I don't know that it applies here but one limitation of the docs</div><div>is that they can get too voluminous.  Already, it is a significant time</div><div>investment just to read the doc page on builtin functions.  You can</div><div>kill a whole afternoon just reading the docs for unittest and logging.</div><div>The gestalt of the language gets lost when the docs get too fat.</div><div>Instead, I like the howto write-ups because they bring together many </div><div>thoughts on a single topic. </div></div></body></html>