On Mon, Jun 23, 2008 at 12:17 AM, John Gunderman
<[EMAIL PROTECTED]> wrote:
> 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:
>
> contai
You can also subclass the dictionary type so that this happens transparently.
You could do something similar with lists.
class Container(dict):
def __setitem__(self, key, value):
dict.__setitem__(self, key, value)
if hasattr(value, 'setParent'):
if callable(value.setPare
"John Gunderman" <[EMAIL PROTECTED]> wrote
I am looking for a way to tell a object the properties of its
containing object.
Can you explain why. Thats usually a bad idea.
At the very least it should call a method of the containing
object rather than "access its properties" (assuming you
mean