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

Daniel Mark danielmarkhot at gmail.com
Wed Sep 20 13:39:26 EDT 2006


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?


Thank you
-Daniel




More information about the Python-list mailing list