Skip to content

Instantly share code, notes, and snippets.

@ryangraham
Created September 16, 2014 20:05
Show Gist options
  • Save ryangraham/b54d3d4b5e013a586fa5 to your computer and use it in GitHub Desktop.
Save ryangraham/b54d3d4b5e013a586fa5 to your computer and use it in GitHub Desktop.
weakref to parent object in python class constructor
import weakref
Class MyClass():
def __init__(self, parent):
self.parent = weakref.ref(parent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment