[Python-ideas] __sort__ special member

Nick Coghlan ncoghlan at gmail.com
Sat Jul 21 01:19:50 CEST 2012


Because the decision of how sorting should occur is up to the consumer, not
the provider. sorted() has the contract to produce a list, using an
algorithm that makes a lot of guarantees about the results. If objects are
allowed to override sorting completely, then those guarantees are no longer
possible.

--
Sent from my phone, thus the relative brevity :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120721/888b5fdb/attachment.html>


More information about the Python-ideas mailing list