[Tutor] Self-referential objects and garbage collection
VanL
van@lindbergs.org
Tue, 20 Mar 2001 07:54:24 -0700
Hello,
How does Python deal with self-referential objects? For example:
class DLinkedList:
def __init__(self, name, objprev=None, objnext=None):
self.__label = name
if objprev: self.__prevlink = objprev
if objnext: self.__nextlink = objnext
else:
self.__prevlink = self
self.__nextlink = self
[methods snipped]
I had understood that Python used a reference-counting scheme. Is
this true, and is there a __destroy__ method to call for circular
data structures?
Thanks,
Van