> The InstanceCounted.count is 1 at the end. If I omit the call to 
> "self.method = print_exception_decorator(self.method)" then the instance 
> count goes down to 0 as desired. I thought that the decorator might be 
> holding a reference to the instance through the bound method, so I added 
>   the __del__() but it doesn't fix the problem.

Adding __del__ introduces a whole bunch of new issues with cyclic gc.
http://docs.python.org/library/gc.html#gc.garbage

> Can anyone suggest anything? Is my technique to decorate bound methods 
> not a good one? How else should I decorate a bound method?

You shouldn't use __del__ to count your instances. Instead you can use
sys.getrefcount() and gc.get_objects() or use a weakref with a callback.

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to