Re: Passing a method indirectly

2006-03-05 Thread swisscheese
Thanks - that worked! Thanks to the other replies also. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing a method indirectly

2006-03-04 Thread Steve Holden
swisscheese wrote: > I'm trying to write a function that takes an arbitrary object and > method. > The function applies the method to the object (and some other stuff). > I get error "Test instance has no attribute 'method' " > How can I make this work? > > def ObjApply (object,method): > ob

Re: Passing a method indirectly

2006-03-04 Thread Farshid Lashkari
You don't need to pass the object along with the method. The method is bound to the object. Simply call the method by itself: def ObjApply(method): method() class Test: def test1 (self): print "Hello" def test2 (self): ObjApply(self.test1) ta = Test () ta

Re: Passing a method indirectly

2006-03-04 Thread André
swisscheese wrote: > I'm trying to write a function that takes an arbitrary object and > method. > The function applies the method to the object (and some other stuff). > I get error "Test instance has no attribute 'method' " > How can I make this work? > > def ObjApply (object,method): > ob

Passing a method indirectly

2006-03-04 Thread swisscheese
I'm trying to write a function that takes an arbitrary object and method. The function applies the method to the object (and some other stuff). I get error "Test instance has no attribute 'method' " How can I make this work? def ObjApply (object,method): object.method () class Test: