Velocity Reviews

Velocity Reviews (
-   Python (
-   -   variable arguments, but on function call (

devnike 09-20-2006 07:33 AM

variable arguments, but on function call

You all know about "*arg" or "**args" in function definitions : so the function definition doesn't have to know about what are the arguments or how many of them...

Well I need the same concept, but on the caller side !
The function is defined with normal arguments.

I programatically receive the function argument names and values.
I now need to call it...

I'm under Zope, and the function is in fact another python script.
Because of Zope, no "eval" is available.

Calling the function without parameters, or with fixed ones is easy :
# or

Finding its arguments is also easy :

Now how to make the call when I receive argument values from a list or a dictionery for example (not knowing how many of them) !?

Anybody has a bright idea ?

devnike 09-20-2006 07:22 PM

[answer to myself]

Althought not super-documented, the solution is simple :

def func(param1,param2):

can be called like this:


so I just have to build a dictionnary...

All times are GMT. The time now is 08:18 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.