title: Access parent object without referencing it
body: <p>I've bumped into a refcount problem where objects don't get deleted because there's an "unnecessary" member referencing the parent (circular reference).</p>
  
  <p>Here's the shortened version:</p>
  
  <pre><code>class User(object):
      __slots__ = ("driver")
      def __init__(self, *params):
          self.driver = getDriverType(params)()
          self.driver.parent = self
  
      def getFancyObject(self):
          return FancyObject(self)
  
  class Driver(object):
      def __init__(self):
          self.parent = None
      def specialCode(self):
          self.parent.getFancyObject()
          ...
          # driver-specific code doing something with fancyObject
  </code></pre>
  
  <p>In order to do driver-specific stuff, I still need the advanced functionality only the parent provides (again, through driver-provided functions). I could do without the FancyObject instance, but then a lot more code would have to be typed.</p>
  
  <p>Of course, creating this reference to parent prevents both parent and driver to be destroyed which not only takes up RAM in the Python VM, but also hardware resources this driver handles. Sunce every instance of <code>User</code> remains, this quickly escalates to unresponsive app and out-of-memory exceptions.</p>
  
  <p>Needless to say, the <code>__slots__</code> in <code>User</code> class prevent weakref.ref to be created on that class.</p>
  
  <p>Admittedly, I'm so wrapped into this issue I just can't see a nice Pythonic solution to this issue.</p>
  
  <p>How can I achieve the desired functionality without creating references that prevent object gc?</p>