[Tutor] Object attributes surviving deletion
Shrutarshi Basu
technorapture at gmail.com
Thu Jun 26 23:59:23 CEST 2008
Here's the relevant function:
def parse_display(self ):
try:
gram = Grammars(10, 10, self.pc_map, self.hard_rules)
gram.database = {}
for key, list in self.grammars.iteritems():
gram.addGram(key, list[0], list[1])
self.modules.append(DisplayModule(self.img_map,
(self.xOrigin, self.yOrigin), self.rows, self.columns, gram,
self.type))
del gram
self.pc_map = {}
self.hard_rules =[]
self.grammars = {}
self.img_map = {}
except Exception, inst:
print inst
As you can see, not only do I delete gram, I also blank out everything
that should be cleared. I have to manually clear gram.database because
otherwise it keeps the data from previous calls to that function. I
don't understand why this should be. DisplayModule is a class that
packages and organizes the data into a convenient form.
Thanks,
--
The ByteBaker :
http://www.bytebaker.com
More information about the Tutor
mailing list