Last active
August 29, 2015 14:15
-
-
Save realeroberto/408371e73387b5132610 to your computer and use it in GitHub Desktop.
A generic equality mixin in Python.
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
# Generic equality mixin | |
# http://stackoverflow.com/questions/390250/ | |
class EqualityMixin(object): | |
def __eq__(self, other): | |
if type(other) is type(self): | |
return self.getX() == other.getX() and self.getY() == other.getY() | |
else: | |
return False | |
def __ne__(self, other): | |
return not self.__eq__(other) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment