[issue45530] Improve listobject.c's unsafe_tuple_compare()

Stefan Pochmann report at bugs.python.org
Tue Oct 19 22:14:03 EDT 2021


Stefan Pochmann <stefan.pochmann at gmail.com> added the comment:

That's how Elliot did it in the original proposal: https://bugs.python.org/issue28685

Back then you pointed out that "Else we can assume u[0] == v[0]" isn't true for float('nan') values:
https://github.com/python/cpython/pull/582#issuecomment-285838656
https://github.com/python/cpython/pull/582#issuecomment-285841789

If you sort objects that always return True for both `<` and `==`, this would also have the opposite problem, considering tuple u smaller than v when it shouldn't.

That said, maybe the function could be optimized for known "well-behaving" types?

----------
nosy: +Stefan Pochmann

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45530>
_______________________________________


More information about the Python-bugs-list mailing list