I could be off topic, but remember that if you just want to pass a variable number of arguments, the pythonic way is to pass a *args tuple or a **kargs . They are optional and better than the syntax myFunc([1, 2, 3]) .
If you want to pass a tuple:
def myFunc(arg1, *args): print args w = [] w += args print w >>>myFunc(1, 2, 3, 4, 5, 6, 7) (2, 3, 4, 5, 6, 7) [2, 3, 4, 5, 6, 7]
If you want to pass a dictionary:
def myFunc(arg1, **kargs): print kargs >>>myFunc(1, option1=2, option2=3) {'option2' : 2, 'option1' : 3}
Mapad Dec 15 '08 at 8:33 2008-12-15 08:33
source share