Python · Classes and objects
__eq__
Defines equality. Return NotImplemented for unrelated types so Python can try the other side.
Syntax
def __eq__(self, other):Example
Open in the lab
More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.