Using Python how can I have multiple class instances with their own objects as members? -
i trying have 2 objects of same class have own object member...when call function of individual classes, function being called both top-objects...
like this...
class operation(threading._timer): def __init__(self): threading._timer.__init__(self) def cancel(self): self.finished.set() class manager(): def __init__(self): self.ops = operation() def stop(self): self.ops.cancel() class a(object): def __init__(self): self.classmanager = manager() instance1 = a() instance2 = a() instance1.classmanager.stop() # when call instance1.classmanager.stop(), stops instance2's manager.operation....
i've looked around , found if class has __init__(self): members defined self tag, should individualized particular instance of class...
thanks
Comments
Post a Comment