passing *args "recursively"

Mikael Olofsson mikael at isy.liu.se
Tue May 13 03:15:19 EDT 2008


Guillermo wrote:
>> This must be very basic, but how'd you pass the same *args several
>> levels deep?
>>
>> def func2(*args)
>>     print args # ((1, 2, 3),)
>>     # i want this to output (1, 2, 3) as func1!
>>     # there must be some better way than args[0]?
>>
>> def func1(*args):
>>     print args # (1, 2, 3)
>>     func2(args)
>>
>> func1(1,2,3)

Me, myself and I wrote:
> func2(*args)
> 
> Thats all. See 
> http://docs.python.org/tut/node6.html#SECTION006740000000000000000

That was a bit unclear. You should use func2(*args) when you call the 
function.

/MiO



More information about the Python-list mailing list