Compare object instances for equality by their attributes
I have a class MyClass, which contains two member variables foo and bar: class MyClass: def __init__(self, foo, bar): self.foo = foo self.bar = bar I have two instances of this class, each of which has identical values for foo and bar: x = MyClass(‘foo’, ‘bar’) y = MyClass(‘foo’, ‘bar’) However, when I compare them … Read more