Nope. flip_incomparables_key does not work, and neither my key. This one works:

```
import functools

@functools.cmp_to_key
def iliadSort(a, b):
    if a < b:
        res = -1
    elif not b == b:
        res = -1
    else:
        res = 0
    
    return res



x = float("nan")
y = float("nan")
print(sorted([x, 6, -10, float("-inf"), 1981, 8, y, float("+inf"), 19, 23], 
key=iliadSort))
```

result:

```
[-inf, -10, 6, 8, 19, 23, 1981, inf, nan, nan]
```

but works only for NaNs and requires also "=="... 0_____o
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/OMVKGODGQAFXPJE2EMRBHU7NXDRZ636Y/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to