-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Description
Python (version 3, at least) raises an error, but NumPy uses lexicographic order (see #11505 for discussion).
We should clean this up to match Python. This behavior is fine for sorting, but I don't think it makes sense for comparisons between numbers. I think most comparisons between complex numbers are probably latent bugs (as was the case where I discovered this).
My suggestion would be to start by issuing a DeprecationWarning, and then maybe make it a true error at some point in the distance future.
Reproducing code example:
>>> x = 1 + 1j
>>> y = 2 + 1j
>>> x < y
TypeError: '<' not supported between instances of 'complex' and 'complex'
>>> np.array(x) < np.array(y)
TrueNumpy/Python version information:
1.18.2 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0]
mruberry, hameerabbasi, nschloe, NeilGirdhar, jbrockmendel and 1 more