You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should _comparator return NotImplemented instead of raising TypeError? #316
According to the NotImplemented documentation (emphasize by me):
Special value which should be returned by the binary special methods (e.g. __eq__(), __lt__(), __add__(), __rsub__(), etc.) to indicate that the operation is not implemented with respect to the other type; may be returned by the in-place binary special methods (e.g. __imul__(), __iand__(), etc.) for the same purpose. It should not be evaluated in a boolean context.
Should we return NotImplemented instead of raising TypeError?
changed the title [-]Should _comparator raise NotImplemented instead of TypeError?[/-][+]Should _comparator return NotImplemented instead of raising TypeError?[/+]on Nov 5, 2020
I think this would make sense since this function is meant to be used in the __gt__ magic method and family. I also don't see much of a problem changing this because we're making it private.
Activity
[-]Should _comparator raise NotImplemented instead of TypeError?[/-][+]Should _comparator return NotImplemented instead of raising TypeError?[/+]tlaferriere commentedon Nov 6, 2020
I think this would make sense since this function is meant to be used in the
__gt__magic method and family. I also don't see much of a problem changing this because we're making it private.Sounds good to me overall.
Fix python-semver#316: Return NotImplemented for comparisons
Merge pull request #318 from tomschr/bugfix/316-notimplemented