Calling function keywords from a dictionary
From: Alexander Straschil (e9526547_at_stud3.tuwien.ac.at)
Date: 03/26/04
- Next message: Sibylle Koczian: "Re: mxDateTime function DateFromString gives wrong year"
- Previous message: sarmin kho: "changing the python executable icon"
- Next in thread: Peter Otten: "Re: Calling function keywords from a dictionary"
- Reply: Peter Otten: "Re: Calling function keywords from a dictionary"
- Reply: Aloysio Figueiredo: "Re: Calling function keywords from a dictionary"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Mar 2004 10:45:17 GMT
Hello!
I'm fooling around with a class wich can map cgi-parameters to
function named parameter.
I have a dic like
dic = {
'action': 'myfunc',
'x': 1,
'y': 2,
'z': 3
}
and I have a method
def myfunc(x, y, z, a=None, b=None)
What I want to do ist calling the method defined in 'action' with
all the named parameter, also instead of
self.myfunct(x=1, y=2, z=3)
I want to do
f = getattr(self, dic['action'])
f(named parameter from the dic)
Its a little like zope does it, but i didnt find it in the Zope Sources ;-)
How can do that?
Thanks, AXEL.
- Next message: Sibylle Koczian: "Re: mxDateTime function DateFromString gives wrong year"
- Previous message: sarmin kho: "changing the python executable icon"
- Next in thread: Peter Otten: "Re: Calling function keywords from a dictionary"
- Reply: Peter Otten: "Re: Calling function keywords from a dictionary"
- Reply: Aloysio Figueiredo: "Re: Calling function keywords from a dictionary"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]