-
Notifications
You must be signed in to change notification settings - Fork 106
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
Some objects that define __eq__ should define __hash__ #843
Comments
Yes, I think common practice is to use the "defining" members of a class and XOR their hashes. Related topic for later: |
Second thought on hashing: I'm not so sure if it makes sense for spaces. There are a bunch of numerical values involved, most prominently |
Well we simply have to ensure that any two spaces who compare equal also hash equal, I think we don't have any fancy "close" tests for exponents etc, but actually require strict equality, no? |
Did a very simply addition of simply hashing all things that went into the |
Interesting, I didn't know that |
Sure, and I was more imagining somebody trying to use a space as a dictionary key. And whenever any of the space properties rely on computations, we're doomed (regarding hashing). But it's not a big deal I guess, |
Basically the standard (since python 3) says:
So, I noticed this while trying to hash ODL spaces in #840.
Luckily, all of our spaces are immutable, as are all other sets. Hence we should add
__hash__()
to them.I'll solve this as part of #840.
The text was updated successfully, but these errors were encountered: