comparing two lists
__peter__ at web.de
Fri Aug 24 09:52:23 CEST 2007
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:
# removing items
db_items = set(Item(**d) for d in dblist)
delenda = items - db_items
for item in delenda:
> (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...
More information about the Python-list