[Tutor] How to delete a class instance

Kent Johnson kent37 at tds.net
Thu Mar 17 15:26:37 CET 2005


Kent Johnson wrote:
> Shitiz Bansal wrote:
> 
>>
>>> In the code you have shown, I don't see any need for
>>> the queue. Just create the thread and start it. I don't think you 
>>> have to keep a reference to it.
>>> I'm not sure, but I think the thread will be garbage collected when 
>>> it completes. (Can anyone
>>> else confirm this?)
>>
>>
>>
>> This does make sense,but how can we confirm that the
>> instance is not garbage collected before it ends?is
>> this the default behyaviour?
> 
> 
> I just asked on comp.lang.python, we'll see what the experts say.

You can see my question and Martin v. Löwis' answer here:
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/1ae7b20b397c4a7e/8d458a7dfaec1d42?tvc=2

He clearly says that the thread will not be GCed until after it completes, so you don't have to save 
a reference to it.

Kent



More information about the Tutor mailing list