Quansight-Labs / numpy.net

A port of NumPy to .Net
BSD 3-Clause "New" or "Revised" License
128 stars 14 forks source link

Inconsistent equality #16

Closed Happypig375 closed 2 years ago

Happypig375 commented 2 years ago

https://github.com/Quansight-Labs/numpy.net/blob/master/src/NumpyDotNet/NumpyDotNet/ndarray.cs#L518-L560 why are some types only available in == and others in Equals?

KevinBaselinesw commented 2 years ago

If I remember correctly, the problem was that in some cases, .NET uses == to try and do object reference comparison which is part of the language. If I tried to override that then I also have to override != and it was causing problems in other areas.

Based on the items you selected, I am not sure which specific items you are having a problem with. If you can be more specific about which data type you think should work with == let me know and I will try to investigate it.

It has been a while since I solved this problem so I don't remember all of the details but I came to the conclusion that == wasn't going to work for all the datatypes. It is one of the differences between C# and Python that we have to live with.

Happypig375 commented 2 years ago

hmm ok thanks