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

Call __eq__ from __ne__ for user defined __eq__ #593

Merged
merged 1 commit into from
Nov 25, 2023
Merged

Conversation

jcrist
Copy link
Owner

@jcrist jcrist commented Nov 25, 2023

If a user manually defines an __eq__ for a Struct class, the default __ne__ implementation will now call the user-defined __eq__ and invert the result, rather than applying the standard __ne__ logic. This makes it easier for users to manually override __eq__, and matches the behavior of standard python classes.

Fixes #585.

If a user manually defines an `__eq__` for a `Struct` class, the default
`__ne__` implementation will now call the user-defined `__eq__` and
invert the result, rather than applying the standard `__ne__` logic.
This makes it easier for users to manually override `__eq__`, and
matches the behavior of standard python classes.
@jcrist jcrist merged commit 36b6aa8 into main Nov 25, 2023
8 checks passed
@jcrist jcrist deleted the struct-override-eq branch November 25, 2023 03:31
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.

__ne__ does not defer to custom __eq__
1 participant