Calling a method using an argument

C Gillespie csgcsg39 at hotmail.com
Fri Feb 4 04:23:54 EST 2005


Dear All,

Many thanks

Colin
"C Gillespie" <csgcsg39 at hotmail.com> wrote in message
news:ctth3v$o2r$1 at ucsnew1.ncl.ac.uk...
> 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