func(*params)

David Duerrenmatt dduerrenmatt at swissonline.ch
Fri Nov 18 16:38:08 EST 2005


Hi there

For some reasons, I've to use Python 1.5.2 and am looking for a workaround:

In newer Python versions, I can call a function this way:

func = some_function
func(*params)

Then, the list/tuple named params will automatically be "expanded" and 
n=len(params) arguments will be submitted.

Python 1.5.2 doesn't support this kind of function call. I could use 
some workaround like:

func(params[0],params[1]...)

but since the number of items in params varies and depends on the mapped 
function "some_function", this isn't a good solution.

Another idea is to use exec(), don't know whether this is safe...

Any recommondations or tricks?


Thanks,
david



More information about the Python-list mailing list