Skip to content

Instantly share code, notes, and snippets.

@saghul
Created July 29, 2011 19:54
Show Gist options
  • Save saghul/1114589 to your computer and use it in GitHub Desktop.
Save saghul/1114589 to your computer and use it in GitHub Desktop.
Don't forget __ne__
In [1]: class Foo(object):
...: def __init__(self, bar):
...: self.bar = bar
...: def __eq__(self, other):
...: return self.bar == other.bar
...:
...:
In [2]: Foo('baz') == Foo('baz')
Out[2]: True
In [3]: Foo('baz') != Foo('baz')
Out[3]: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment