Possible Duplicate:
Having more then one parameter with def in python
I need to make a function call which will contain a variable number of parameters - The parameters are contained in a list.
It would "look" like this for a list of 2 items:
TheFunction(item1, item2)
And for a list of 3 items:
TheFunction(item1, item2, item3)
Is there any easy, pythonic way of doing this? Some kind of loop using getattr()
, for instance?
The list is of a variable size - I need to be able to call the function with just the list presented as a argument in the code. Specifically, I am calling the client.service.method() function in SUDS to call a web service method. This function accepts a variable number of arguments, I'm simply having trouble with calling it with a variable number of arguments.