[Tutor] references to containing objects
John Gunderman
meanburrito920 at yahoo.com
Mon Jun 23 06:17:30 CEST 2008
I am looking for a way to tell a object the properties of its containing object.
For example, I have an object foo, of class Bar, which I have stored in a dict
in the object I want to access. Basically:
container_object.contained_object["foo"].action()
What I want is for the object "foo" to be able to access properties of container_object
through its action() method. the problem is that I don't know what the containing
object's name is going to be before hand, so I can't just access it through the
object's name. I'm thinking I could create a dict of the container_objects, so
when the object was created the name could be passed to the action() method, but
is there another way to do it?
Thanks in advance.
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080622/f0fe953f/attachment.htm>
More information about the Tutor
mailing list