Do we need to delete "ImageDraw.Draw" after using it?

Fredrik Lundh fredrik at pythonware.com
Thu Sep 21 04:04:03 EDT 2006


Steve Holden wrote:

>> Is there any general rule that we must delete the object after using
>> it?
>>
> Just consider it good hygiene.

in this specific case, it may not be obvious for the casual reader that 
the global "draw" variable will contain an indirect reference to the 
original image object, so even if you throw away (or replace) the "im" 
variable with something else, the original image will still be present
in memory.

if you put the same code inside a function, you can safely leave the 
garbage handling to Python.

</F>




More information about the Python-list mailing list