Calling member functions?
david_j_dawkins at spamless.hotmail.com
Thu Dec 13 12:20:52 CET 2001
I can't quite get this right. How can I give an object instance and a method
as a callback for some other module/class to call at a later point?
print "Callback called"
def __init__(self, object, method):
self.m_object = object
self.m_method = method
## Now what??
self.m_method(self.m_object) ## naive attempt
h = Handler()
n = Notifier( h, h.Callback )
h.notify() # I want this to do h.Callback() in effect
david_j_dawkins x/AT/x hotmail.com
More information about the Python-list