Getters and Setters

tim_one at email.msn.com tim_one at email.msn.com
Thu Jul 15 16:17:31 EDT 1999


[about whether Tim's GetterSetter code created cycles]

[Bernhard Herzog <herzog at online.de]
> The cycle doesn't involve self, but self's dict will hold an
> indirect reference to itself. The instance object will be
> deleted, so it's __del__ method is called, but its __dict__
> won't be deleted:

Ah -- got it.  Thanks for the explanation.  self.__del__ is called,
though, so the cycles are easy to break:

def __del__(self):
    self.__dict__.clear()

even-tested-it-this-time<wink>-ly y'rs  - tim




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list