[Python-Dev] Generic notifier module
Fredrik Lundh
fredrik@pythonware.com
Thu, 20 Apr 2000 15:55:52 +0200
Moshe Zadka" wrote:
> > object.denotify(message[, callback]) - Turn off notification.
>=20
> You need to be a bit more careful here. What if callback is
> foo().function? It's unique, so I could never denotify it.
if you need a value later, the usual approach is to
bind it to a name. works in all other situations, so
why not use it here?
> A better way, and more popular (at least in the signal/slot =
terminology),
> is to return a cookie on connect, and have disconnect requests by a =
cookie.
in which way is "harder to use in all common cases"
better?
...
as for the "break" functionality, I'm not sure it really
belongs in a basic observer class (in GOF terms, that's
a "chain of responsibility"). but if it does, I sure prefer
an exception over a magic return value.
</F>