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

Explicitly use object-identity–based equality for SOMA objects #108

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

thetorpedodog
Copy link
Contributor

When inheriting from a type that defines an __eq__ operation, that __eq__ will override the built-in __eq__. In the case of the MutableMapping type, that means that it will try to use element-wise comparison against any other mapping type. This is effectively an attractive nuisance. Instead, we explicitly use the default comparison, which is based on object identity rather than contents or anything.

Copy link
Member

@atolopko-czi atolopko-czi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

When inheriting from a type that defines an `__eq__` operation, that
`__eq__` will override the built-in `__eq__`. In the case of the
`MutableMapping` type, that means that it will try to use element-wise
comparison against any other mapping type. This is effectively an
attractive nuisance. Instead, we explicitly use the default comparison,
which is based on object identity rather than contents or anything.
@thetorpedodog thetorpedodog merged commit 369f22b into main Feb 1, 2023
@thetorpedodog thetorpedodog deleted the eq-and-hash branch February 1, 2023 18:10
@johnkerl johnkerl changed the title Explicitly use object-identity–based equality for SOMA objects. Explicitly use object-identity–based equality for SOMA objects Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants