Resources and non-exhausted generators

Hamish Lawson hbl at st-andrews.ac.uk
Thu May 2 11:49:53 EDT 2002


Sean 'Shaleh' Perry wrote:

> > ... (with probably also an explicit method for allowing this to be
> > done earlier than object destruction). ...
> 
> 'del object' will do it earlier (-:

Using del to delete a reference will indeed increase the likelihood that
the referenced object will be destroyed earlier. I was allowing for the
fact that this is only an increased likelihood and not a certainty,
since the object's destruction (and hence the call of __del__) may not
happen immediately upon the disapperance of the last reference. 

Hamish





More information about the Python-list mailing list