Created
September 19, 2014 22:02
-
-
Save willrjmarshall/d4152551a569c7741556 to your computer and use it in GitHub Desktop.
This file contains 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
class Parent(object): | |
def log_message(self, string): | |
self.c_instance.log_message(string) # Calling a C bridge | |
def create_children(self): | |
self.child1 = Child(self) | |
self.child2 = Child2(self) | |
class Child(object): | |
def __init__(self, parent): | |
self.parent = parent | |
self.grandchild1 = Grandchild(parent) | |
self.parent.log_message("some message") | |
class Child2(object): | |
def __init__(self, parent): | |
self.parent = parent | |
self.grandchild2 = Grandchild2(parent) | |
self.parent.log_message("another message") | |
class Grandchild(object): | |
def __init__(self): | |
self.parent = parent | |
self.parent.log_message("grandchild loaded") | |
class Grandchild2(object): | |
def __init__(self, parent): | |
self.parent = parent | |
self.parent.log_message("grandchild loaded") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment