KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In Python, is it possible to get the object, say Foo , that contains another object, Bar , from within Bar itself? Here is an example of what I mean: class Foo(object): def __init__(self): self.bar = Bar() self.text = "Hello World" class Bar(object): def __init__(self): # I want to access the properties of the container object self.newText = foo.text foo = Foo() Is this possible?
Tags (comma-separated)
Save Edits
Cancel