[Tutor] help with refactoring needed -- whichapproach ismorePythonic?

Alan Gauld alan.gauld at freenet.co.uk
Sat Feb 12 00:50:54 CET 2005


> > - otherwise you get circular references which can cause memory
> > leaks by confusing the garbage collector!
> 
> CPython has been able to GC cycles since version 2.0.

Yep but it takes a lot longer. The cycle detection sweep 
only occurs periodically if I remember rightly, and if you 
are doing a lot of processing you can still get process growth.
So as a matter of course I tend to add a __del__ any time 
I create a list of objects inside another object.

Maybe its just my C++ paranoia showing through! :-)

Alan G.


More information about the Tutor mailing list