Python 2.0

Graham Matthews graham at sloth.math.uga.edu
Mon Jun 7 18:31:44 CEST 1999


Graham Matthews wrote:
> so I don't understand the above comment? As for circularly
> referred data it will be deleted in the order determined by the collector,
> but that's better than current Python which doesn't delete it at all.
Salvador =?iso-8859-1?Q?Fandi=F1o?= (fandino at usa.net) wrote:
: If I can't remove objects in the right order I would have to delete it
: explicitly the same way I have to do it now with ref counting. Lots of
: current __del__ methods will not perform properly and will raise
: exceptions if called after deleting related objects.
: You could use __del__ methods only for trivial task like freeing
: resources. It's an incomplete solution like reference counting is.

I really don't understand this. A lot of languages (eg. Java) have
garbage collection and finalisers. All these languages manage to delete
objects in an order that does not cause any problems (all finalisers etc
work). If a collector can do that in these languages why can't it do in
Python (__del__ methods are Python's finalisers)? 

I am very very confused by your question. You seem to have a misconception
about __del__ methods. They are finalisers, used only to close resources
like files, etc. In a garbage collection scheme the __del__ methods are
not used to implement the actual collection.

graham
-- 
             You wanna get close to me
              The feeling's so clear
            But I need some time to see
              Vision through my tears




More information about the Python-list mailing list