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

Add __hash__ method to DAGSet #4

Merged
merged 2 commits into from
Feb 2, 2024
Merged

Conversation

paulromano
Copy link
Contributor

If a Python class defines __eq__ but not __hash__, it is not usable in sets or as a dictionary key. This PR adds the __hash__ method to DAGSet so that they are hashable.

Copy link
Member

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Made a few updates to account for the model in the __eq__ and __hash__ methods of DAGSet. Lmk what you think @paulromano.

dagmc/dagnav.py Outdated Show resolved Hide resolved
@paulromano
Copy link
Contributor Author

Yup, that makes perfect sense -- thanks for the update!

@pshriwise pshriwise merged commit 38aeb4a into svalinn:main Feb 2, 2024
1 check passed
@paulromano paulromano deleted the dagset-hash branch February 3, 2024 19:13
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