Created
          September 16, 2014 20:05 
        
      - 
      
- 
        Save ryangraham/b54d3d4b5e013a586fa5 to your computer and use it in GitHub Desktop. 
    weakref to parent object in python class constructor
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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