On Wed, 01 Oct 2008 21:54:26 -0700, Dan Barbus wrote: > def __del__(self): > Item._count -= 1 > # Should I do something here to delete the instance? > # Will this ever be called if the instance is in a static > dictionary?
Don't use the `__del__()` method. It is not reliable as there are almost no guarantees when or if at all it will be called. But its sole existence may be the cause that objects of that class can't be garbage collected. Read the documentation of `__del__()` for details. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list