How to call a mothod in a class by the method name string and the instance?

yy x flingfly at gmail.com
Thu Feb 16 02:44:38 EST 2006


hi, all:
  for example, the following class:
class test:
    def funca(self):
        print  "in funca"
    def funcb(self):
        print  "in funcb"
t = test()
t.funca()

    In the plain way,  i will excute the funca by the code "t.funca() ",
but if i wanna to excute the funca by "t" and string "funca", how will i do?

maybe the idea is similiar to "call(t, "funca") ".

best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060216/564d92ea/attachment.html>


More information about the Python-list mailing list