Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
-1 I am flat opposed to special casing the list.sort() code for the specific case of NaNs. This is an incorrect delegation of responsibility. The sorted objects are responsible for saying how they will sort and whether than is. deterministic. Note, float('NaN') isn't the only case. Sets objects only have a partial ordering. Also note that list.sort() isn't the only tool that compares objects. There is also min(), max(), heaps, bisect, etc. For the most part, we've able to keep those all it sync with one another by a clear separation of responsibilities (objects decide how they are compared versus tools that use comparisons). At the very least, this would need a python-ideas discussion. FWIW, the usual solution to this problem is to strip the NaN values using math.isnan(). ---------- nosy: +mark.dickinson _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36095> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com