KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So, I'm trying to get the object that a custom object is 'inside' of. Here's an example. Assume that o is an object - it doesn't matter what kind, it can just store variables. o = Object() class Test(): def __init__(self): self.parent = o ## This is where I fall off; I want to be able to access ## the o object from within the Test object o.test = Test() So, how would I get o from inside of Test? I know I could write the Test function to pass it in with o.test = Test(o) but I'd rather do it from inside the class definition.
Tags (comma-separated)
Save Edits
Cancel