Parent references: hot or not?

Dylan Reinhardt python at dylanreinhardt.com
Sat Apr 19 13:07:41 EDT 2003


On Sat, 2003-04-19 at 10:00, Dylan Reinhardt wrote:

> Sounds like I should be sure to write a __del__ method for Container
> that ensures things work correctly.

And upon re-reading your post you say *not* to do that... :-)

I'd like to understand that a bit better.  What would be wrong with:

class Container:

   def __del__(self):
      # ensure all Items are deleted first
      for item in self.items.keys():
         del self.items[item]


Thanks,

Dylan






More information about the Python-list mailing list