Weakref.ref callbacks and eliminating __del__ methods

Richie Hindle richie at entrian.com
Mon Jan 24 10:33:11 EST 2005


[me]
> why the `self.btree = None` in the last line?

[Mike]
> It's to allow the Closer object to act as a substitute for a .close() 
> method on the object [...] If the user explicitly calls storage.close()
> we don't want the __del__ trying to re-close the storage later.  In
> other words, its an explicit requirement for *this* __del__, not a general
> requirement.

I see, yes.  Very clever - thanks for the explanation!

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list