[Tutor] class methods as argument

thomas coopman thomas.coopman at gmail.com
Sat Feb 10 12:39:30 CET 2007


I want to do something like this, don't know how to properly explain it,
so I just give you some example code

>>>class Foo(object):
>>>	def method(self, arg):
>>>		print arg

>>>def doSomething(object, func):
>>>	object.func("test")

>>>object = Foo()
>>>doSomething(object, Foo.method)

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,
Is it possible?
and how?


More information about the Tutor mailing list