Home

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

previous
next

Re: How to create a file on users XP desktop
Re: Python 3.0 migration plans?
Re: Unable to read large files from zip
Re: help with a c++ calculator
Re: The Modernization of Emacs: terminology buffer and keybinding
SEO
asg
andrzej dąbrowski
kasyno
wzory tatuaży