def register(self, slot): if inspect.ismethod(slot): self._methods.add(weakref.WeakMethod(slot)) else: self._functions.add(slot)