Hi Thomas,
thomas coopman wrote: <snip> > I want to execute the class method given as argument, > but this obvious doesn't work, but I don't know how to > get it work, Pass the method reference of the class as argument, like this: >>> class A(object): ... def __init__(self, x): self.x = x ... def dostuff(self, arg): ... print self.x ... print arg ... >>> def dostuff(obj, method): ... method(obj, 'blabla') ... >>> a = A(5) >>> dostuff(a, A.dostuff) 5 # this demonstates method has been called for instance a blabla Yours, Andrei _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
