Last active
December 24, 2022 20:04
-
-
Save sloria/5895762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj == obj2 | |
obj1 is obj2 | |
class Book: | |
... | |
def __eq__(self, other): | |
if not isinstance(other, self.__class__): | |
return NotImplemented | |
return (self.author == other.author and | |
self.title == other.title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment