I realized that we were overwriting the eq method on a number of objects without overwriting the hash method, which I have come to realize is strongly discouraged in Python. So this commit fixes this by adding hash methods that agree with the eq operator. This should also allow us to create sets of these geometry objects if we so desire.
The only thing I didn't implement that might be worthwhile to implement in the future is that I am not caching the hash value once it is calculated, which is something that we could do given that all of the geometry objects are immutable. This will allow for quicker hashing if we plan to hash the object multiple times but it also uses up a little more memory per object to store the hash. Right now, we really don't end up hashing the object multiple times in any of our typical workflows such that I think the trade-off isn't worth it. However, we should reconsider this if we find cases in the future where we are hashing the objects multiple times.
I realized that we were overwriting the eq method on a number of objects without overwriting the hash method, which I have come to realize is strongly discouraged in Python. So this commit fixes this by adding hash methods that agree with the eq operator. This should also allow us to create sets of these geometry objects if we so desire.
The only thing I didn't implement that might be worthwhile to implement in the future is that I am not caching the hash value once it is calculated, which is something that we could do given that all of the geometry objects are immutable. This will allow for quicker hashing if we plan to hash the object multiple times but it also uses up a little more memory per object to store the hash. Right now, we really don't end up hashing the object multiple times in any of our typical workflows such that I think the trade-off isn't worth it. However, we should reconsider this if we find cases in the future where we are hashing the objects multiple times.