Reference Tracking

Matt Bergin spam at mattbergin.co.uk
Sat Apr 12 14:08:06 EDT 2003


I am trying to write a class which gives out objects and keeps track of 
them so they can be returned to the class and given out to other code 
when the code they were given out to no longer has any reference to the 
objects (i.e. has finished using it).

The trouble is, the manual says not to try and stop objects from being 
killed by creating new references in __del__. My original thoughts were 
to write some code in __del__ of the given out object that returned it 
to the original class. Is this is a good way of going about this 
problem? Any ideas would be welcome!

-- 
Matt Bergin





More information about the Python-list mailing list