Does this code create a circular reference ?
ionel at psy.uva.nl
Tue Nov 30 13:57:00 EST 1999
I need advice on whether the situation described below introduces circular
Basically, it is about a class that, within some method,
needs to create a temporary "child" object,
that is an object holding a reference to its "creator".
This is intended as a simple way to share access to certain variables known
by the parent.
I guess a danger in this approach, because the child,
even temporary, will be somehow stored in the locals dictionary of the
I am not sure how it works and if it will cause trouble.
def __init__(self, parent):
self.parent = parent
a_child = child(self)
More information about the Python-list