passing *args "recursively"

Matimus mccredie at gmail.com
Mon May 12 12:29:09 EDT 2008


On May 12, 9:19 am, Guillermo <guillermo.lis... at googlemail.com> wrote:
> Hi,
>
> 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)
>
> Thanks!
>
> Guillermo

def func1(*args):
    print args
    func2(*args) # don't forget the '*'

Matt



More information about the Python-list mailing list