Created
July 29, 2011 19:54
-
-
Save saghul/1114589 to your computer and use it in GitHub Desktop.
Don't forget __ne__
This file contains hidden or 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
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