There are three problems: 1) Dunders like `__lt__` and `__gt__` don't return bool, they return either a bool or the NotImplemented singleton to signal that they don't know how to be compared. 2) The don't take type object, the take `typing.Any` 3) They need to return NotImplemented if the comparison is not implemented, this allows python to try the inverse dunder from the other object. If that object returns NotImplemented as well a TypeError is raised.pull/6301/head
parent
c616686d5d
commit
e88b3c8022
1 changed files with 12 additions and 4 deletions
Loading…
Reference in new issue