This ensures that __ne__ will also work, and makes it easier to
subclass Tree. For example, in the previous implementation you could
have
>>> commA == commB
False
>>> cmp(commA, commB)
0
if the comments had different ids, but equivalent content.
At the user-interface level, this removes some false "modified
comments" from `be diff`.
>>> a.has_descendant(a, match_self=True)
True
"""
- def __eq__(self, other):
- return id(self) == id(other)
+ def __cmp__(self, other):
+ return cmp(id(self), id(other))
def branch_len(self):
"""