Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, madpython > wrote: > > > No it's not the normal way. Why don't you give `c` as argument to the > `interClassCall()`? > > class B(object): > def interClassCall(self, c): > print c.a.a() > > class C(object): > def __init__(self): > self.a=A() > self.b=B() > def c(self): > self.b.interClassCall(self) > > Much less magic involved this way. As far as I remember what you suggest would be perfect solution for Java. In other words it's a matter of getting a reference to "a" (the instance of class A) and your variant just one of the others possible. Maybe I came up with not very good example, so maybe I try to explain it verbally. As I already have written I play with Tkinter and make an application that does some stuff. It uses dynamic GUI building depending on data it process. Also one of the requriments is to separate the program logic from GUI. Here is a short illustration:
... self.b=Tkinter.Button(root,txt="Button",command=self.doSmth).pack() self.l=Tkinter.Label(root,txt="default").pack() def doSmth(self): var=globals()["m"].__dict__["progLogic"].func("some input") self.l.config(txt=var) self.l.update_idletasks() ... I guess it's all correct or at least it close to what I work on. What do you think? If I may I'd say it again that GUI is built according by the data that's passed by the "thinking" part of the program so I don't necessary know what it is (can only guess) and that's why passing references as an argument doesn't seem possible. -- http://mail.python.org/mailman/listinfo/python-list