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

Steve Holden steve at holdenweb.com
Wed Sep 20 15:47:47 EDT 2006


Daniel Mark wrote:
> Hello all:
> 
> I am looking the sample code posted on PIL website
> http://www.pythonware.com/library/pil/handbook/imagedraw.htm
> 
> ################################################
> <<Draw a Grey Cross Over an Image>>
> 
> import Image, ImageDraw
> 
> im = Image.open("lena.pgm")
> 
> draw = ImageDraw.Draw(im)
> draw.line((0, 0) + im.size, fill=128)
> draw.line((0, im.size[1], im.size[0], 0), fill=128)
> del draw # ===>>>> Why we should delete this object draw?
> 
> # write to stdout
> im.save(sys.stdout, "PNG")
> #################################################
> 
> Is there any general rule that we must delete the object after using
> it?
> 
Just consider it good hygiene.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list