how to pass a function name and its arguments inside the arguments of other function?

jmborr borreguero at gmail.com
Fri Nov 2 22:21:30 EDT 2007


I need something like this:

1:  superfoo( non-keyword-args, keyword-args, methodname, *kargs,
*kwargs):
2:       """non-keyword-args  and  keyword-args are arguments that
3:           apply to superfoo, while *kargs and **kwargs are
arguments
4:           that apply to methodname. See below"""
5:       object=someClass()
6:       result=getattr(object,methodname)(*kargs,**kwargs)
7:       return result

The problem is: how can I pass both arguments for superfoo and
methodname in line 1: ? Is it possible?
-Jose




More information about the Python-list mailing list