__del__ methods

Duncan Booth duncan.booth at invalid.invalid
Sat Jul 19 18:10:06 CEST 2008

"Robert Rawlins" <robert.rawlins at thinkbluemedia.co.uk> wrote:
> I like this idea, I can definitely see the benefits to working with
> this concept. One things I will take this quick opportunity to ask,
> even though it's a little OT:
> What is the benefit of extending the base 'object' class? What does
> that give me that en empty, non subclassed object doesn't?
Habit: certain things (such as properties) don't work properly with
old-style classes, so it is good practice always to use new-style
classes and that way you won't forget to do it when it really does

>> You can use gc.get_referrers() to find everything that references a 
>> particular objects and gradually trace backwards until you find the
> problem 
>> reference (it is tricky though as any code which does this needs to
>> ignore 
>> its own references to the object in question).
> Yes, that's a very nice concept and like you say gives you quite a
> nice visual reference of what objects are and aren't being destroyed.

for the code (although I seem to remember that there are some problems
with that code so caveat emptor).

More information about the Python-list mailing list