Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Ordering of dtypes is ill defined #15531

Open
seberg opened this issue Feb 6, 2020 · 1 comment
Open

BUG: Ordering of dtypes is ill defined #15531

seberg opened this issue Feb 6, 2020 · 1 comment

Comments

@seberg
Copy link
Member

seberg commented Feb 6, 2020

The ordering of DTypes is ill defined, due to the fact that equality is much strong than established by casting (forcing the same byte order):

In [1]: f8b = np.dtype(">f8")  
In [2]: f8l = np.dtype("<f8")

In [3]: f8l <= f8b
Out[3]: True

In [4]: f8l <= f8b
Out[4]: True

In [5]: f8l == f8b
Out[5]: False

which is not transitive. I am not sure this is a huge issue, but maybe there is just no point in defining < and > based on casting for dtypes, since can_cast is reasonable and it is not a common operation.
The meaning of == should be set in stone, just due to the amount of code that will be subtly wrong if it does not enforce native byte order anymore.

@seberg
Copy link
Member Author

seberg commented Feb 6, 2020

I am not super concerned about this, but I personally doubt the use and usefulness of operator comparisons, so I feel we might as well deprecate ordering operators (you still have can_cast to establish ordering if you want to).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant