[Python-ideas] __sort__ special member

Raymond Hettinger raymond.hettinger at gmail.com
Sat Jul 21 02:07:43 CEST 2012


On Jul 20, 2012, at 4:19 PM, Nick Coghlan wrote:

> 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.

Well said.


Raymond

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120720/090710d0/attachment.html>


More information about the Python-ideas mailing list