Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

> That sort currently uses __lt__ only is, in my opinion, an implementation 
> detail.

Its only an implementation detail until the language specification defines it 
as a guarantee of the language. Then it becomes part of the sorting API.

Personally, I think it is a nice feature that sorting works for objects which 
define only __lt__, and it sounds like Tim is happy for that to be part of the 
sort API.

This is documented under list.sort() but not sorted():

https://docs.python.org/3/library/stdtypes.html#list.sort

https://docs.python.org/3/library/functions.html#sorted

Rather than removing it from the HOWTO, I would rather document that fact under 
sorted() as well.

If you still want to argue that we should not document this as a language 
guarantee, for the sake of other implementations such as Jython and IronPython, 
you should raise it on Python-Dev. It would probably help if you had other 
implementation maintainers state that this was a burden on them.

For what it is worth, it seems that Jython 2.5 supports this feature too.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35654>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to