def handle_disconnect (self, source): """ Handles the disconnection from the source removing any weak reference from it. """ self._sources = remove_if (lambda x : x () == source, self._sources) super (Trackable, self).handle_disconnect (source)
def handle_disconnect(self, source): """ Handles the disconnection from the source removing any weak reference from it. """ self._sources = remove_if(lambda x: x() == source, self._sources) super(Trackable, self).handle_disconnect(source)
def disconnect_if(self, predicate): """ Disconnects all the sources that satisfy 'predicate', being 'predicate' a boolean function over the destiny objects. """ def pred(dest): if predicate(dest): dest.handle_disconnect(self) return True return False self._destinies = remove_if(pred, self._destinies)
def disconnect_if (self, predicate): """ Disconnects all the sources that satisfy 'predicate', being 'predicate' a boolean function over the destiny objects. """ def pred (dest): if predicate (dest): dest.handle_disconnect (self) return True return False self._destinies = remove_if (pred, self._destinies)