ObjectA calling ObjectB
MidasOneTwo at hotmail.nospam.com
Sat Dec 27 22:37:07 CET 2003
Thanks for replying.
It looks like you hardcoded the name ObjectB within ClassA. I'd like to avoid all hardcoding of names. In other words, I'd like ObjectA to be *told*, at run time, which object to call and which method to call.
On Sat, 27 Dec 2003 21:42:05 +0100, Lawrence Oluyede wrote:
>You could simply do something like this:
> def __init__(self):
> self.ObjectB = B()
> def someMethod(self):
>if __name__ == "__main__":
> ObjectA = A()
More information about the Python-list