Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix #316: Return NotImplemented for comparisons #318

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

Merged
merged 1 commit into from
Nov 8, 2020

Conversation

tomschr
Copy link
Member

@tomschr tomschr commented Nov 8, 2020

The former code raised a TypeError exception for comparisons like __gt__, __lt__ etc. to indicate a wrong type.

However, according to NotImplemented documentation, we should return(!) NotImplemented (not raise) when a comparison with an invalid type is not implemented.

The former code raised a TypeError exception for comparisons
like __gt__, __lt__ etc. to indicate a wrong type.

However, according to NotImplemented[1] documentation,
we should return(!) NotImplemented (not raise) when a
comparison with an invalid type is not implemented.

[1] https://docs.python.org/3/library/constants.html#NotImplemented
@tomschr tomschr added the Bug Error, flaw or fault to produce incorrect or unexpected results label Nov 8, 2020
@tomschr tomschr self-assigned this Nov 8, 2020
@tomschr tomschr merged commit c75737d into python-semver:master Nov 8, 2020
@tomschr tomschr deleted the bugfix/316-notimplemented branch November 8, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant