Calling a method using an argument

C Gillespie csgcsg39 at hotmail.com
Thu Feb 3 10:48:05 EST 2005


Dear All,

I have a simple class
class hello:
    def world(self):
        return 'hello'
    def test(self,arg):
        return self.arg

When I want to do is:
>hello.test('world')
'hello'

i.e. pass the method name as an argument. How should I do this?

Thanks

Colin





More information about the Python-list mailing list