Re: Logging in __del__()

2008-07-16 Thread Marc 'BlackJack' Rintsch
On Wed, 16 Jul 2008 12:38:50 +0100, Robert Rawlins wrote: > So, am I right to assume that python will still handle its garbage disposal > if I implement __del__(), it just handles circular references in a slightly > different way, but to the same effect. Right? No. Circular references in objects

RE: Logging in __del__()

2008-07-16 Thread Robert Rawlins
Hi Vinay, > Python uses reference counting with a cycle detector, but the > detector's behaviour is different if there are finalizers (__del__) - > see > > http://www.python.org/doc/ext/refcounts.html > Thank you for the link, that certainly explains a great deal. So, am I right to assume that

Re: Logging in __del__()

2008-07-15 Thread Vinay Sajip
On Jul 15, 1:51 pm, "Robert Rawlins" <[EMAIL PROTECTED]> wrote: > > Am I right in thinking that Python destroys instances of classes when it > deems they are no longer needed? I shouldn't have to explicitly delete the > classes, right? Python uses reference counting with a cycle detector, but the

RE: Logging in __del__()

2008-07-15 Thread Robert Rawlins
Hi Fredrik, > When the application is running, or when it is shutting down? This is interesting, I did a test where I explicitly destroyed the instance using 'del my_instance' while the application was running and no error was thrown. It would see you are right, when the application ends it kill

Re: Logging in __del__()

2008-07-15 Thread Fredrik Lundh
Robert Rawlins wrote: I then get the following exception thrown when running my code: When the application is running, or when it is shutting down? Traceback (most recent call last): File "/usr/lib/python2.5/logging/handlers.py", line 73, in emit if self.shouldRollover(record): File

Logging in __del__()

2008-07-15 Thread Robert Rawlins
Guys, I'm trying to help trace when instances of particular classes are being destroyed by the garbage collector and thought the cleanest way would be to implement a logging call in __del__() on the class. However, I'm having an issue. I inject a logger instance into my class upon construct