Skip to content

LGTM Alert regarding hash and eq #1743

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

Closed
onlinejudge95 opened this issue Feb 10, 2020 · 3 comments
Closed

LGTM Alert regarding hash and eq #1743

onlinejudge95 opened this issue Feb 10, 2020 · 3 comments
Assignees
Labels
awaiting reviews This PR is ready to be reviewed question

Comments

@onlinejudge95
Copy link
Collaborator

onlinejudge95 commented Feb 10, 2020

We currently have a LGTM alert. The class defines a __hash__ method without defining an __eq__ method.

According to Python docs

If a class does not define an eq() method it should not define a hash() operation either; if it defines eq() but not hash(), its instances will not be usable as items in hashable collections.

Should we go ahead with a PR for the same?

@onlinejudge95 onlinejudge95 added question awaiting reviews This PR is ready to be reviewed labels Feb 10, 2020
@onlinejudge95 onlinejudge95 self-assigned this Feb 10, 2020
@cclauss
Copy link
Member

cclauss commented Feb 10, 2020

Is there documentation or an issue on the LGTM community that explains why this rule exists. I have never heard of it before.

@cclauss
Copy link
Member

cclauss commented Feb 10, 2020

Yes. Please submit a PR.

@onlinejudge95
Copy link
Collaborator Author

Also, I could see certain other issues that are legit.
Should I raise PR for similar types of issues clubbed together, rather than each going on a separate PR. What do you suggest?

@onlinejudge95 onlinejudge95 mentioned this issue Feb 10, 2020
14 tasks
@poyea poyea closed this as completed Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed question
Projects
None yet
Development

No branches or pull requests

3 participants