Ladislav Andel wrote: > need to be stopped before deleting any instance from items. > So I need to call stopLoop method in the given item in items before it > gets removed. > If there is any addition to items it's quite easy to call > item.startLoop() method.
Unless you want to rely on the __del__ method or introduce another complication (weak references) you have to be explicit: # untested # removing items db_items = set(Item(**d) for d in dblist) delenda = items - db_items for item in delenda: item.stopLoop() items.remove(item) > (I use twisted but it should not make any difference): I've not worked with twisted, so I can't confirm that. I can imagine that they provide their own way to spell a finalizer... Peter -- http://mail.python.org/mailman/listinfo/python-list