Instance comparison is not necessarily the same as string comparison.Ok, I see.
Neither __str__ nor __repr__ are implicitly used at all for comparison.
In fact, by default a pair of instances are not equal unless they are theThanks.
same object. To define comparison to mean something, you need to define
__cmp__ or __eq__.
Trivial example of default comparison:
... pass>>>class C:
...False>>>c = C()
d = C()
c==dTrue>>>c==c
Almar Klein:
>but this does not implicitly convert self to a string. You'll have toYes, this works.
do in explicitly:
use "return str(self) == note" instead.
Thanks.