Observer pattern thoughts

Bernhard Herzog bh at
Fri Mar 7 18:29:08 CET 2003

Mitch Chapman <Mitch.Chapman at> writes:

> Bernhard Herzog wrote:
> > Bound methods for the same method of the same object are equal even if
> > the bound methods are not identical:
> [snip]
> Is this true for ZODB Persistent objects?  I've had trouble
> unregistering Persistent callables because they sometimes seem not to
> compare equal.  (This has happened under Python 2.1.3 and
> StandaloneZODB-1.0, so things may have changed.)  Looking at the
> workaround code, it seems that the methods may not compare equal
> even when the instances do.

That may well be the case. Bound methods are only equal if they belong
to the same object, i.e. the ids of the objects are equal. Methods
belonging to equal but not identical objects should never be equal.


Intevation GmbH                       

More information about the Python-list mailing list