Simply put, your comparisons are not directly related to the class data, but an instance of the class itself (id (Foo (1))), because you did not explicitly map it.
It compares the identifier of instances, so sometimes it is True, and in other cases - False.
Foo(1) => <__main__.Foo instance at 0x2a5684> Foo(1) => <__main__.Foo instance at 0x2a571c> Foo(1)
source share