[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Well, if this is indeed by design (and I missed the > list.sort() reference) then I agree the HOWTO should not be changed It is in fact by design :-) -- resolution: -> not a bug stage: -> resolved status: open -> closed

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-04 Thread Terry J. Reedy
Change by Terry J. Reedy : -- versions: +Python 3.8 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-04 Thread Martijn Pieters
Martijn Pieters added the comment: (I have no opinion on this having to be a language feature however) -- ___ Python tracker ___

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-04 Thread Martijn Pieters
Martijn Pieters added the comment: Well, if this is indeed by design (and I missed the list.sort() reference) then I agree the HOWTO should not be changed! I'd be happy to change this to asking for more explicit mentions in the docs for sorted, heapq and bisect that using only < (__lt__) is

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Tim Peters
Tim Peters added the comment: Steven, thanks for noticing the docs! I was surprised to hear it wasn't documented, but not surprised enough to check myself ;-) This decision was suggested by me, and endorsed by Guido, when designing timsort looking ahead to Python 3, where __cmp__ was going

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: I also prefer to leave this as is. FWIW, heapq and bisect are also deliberately based on __lt__. The PEP 8 advice (something I wrote) is primarily about making code less fragile and avoiding surprising behavior. -- assignee: docs@python ->

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Steven D'Aprano
Steven D'Aprano 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

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Tim Peters
Tim Peters added the comment: I don't know that the language needs to define this, but sticking to __lt__ was a wholly deliberate design decision for CPython. -- nosy: +tim.peters ___ Python tracker

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Martijn Pieters
New submission from Martijn Pieters : Currently, the sorting HOWTO at https://docs.python.org/3/howto/sorting.html#odd-and-ends contains the text: > The sort routines are guaranteed to use __lt__() when making comparisons > between two objects. So, it is easy to add a standard sort order to