[Tutor] arguments
Kent Johnson
kent37 at tds.net
Thu Feb 15 14:21:32 CET 2007
emilia12 at mail.bg wrote:
>
> Hi list,
>
> I have a function with two arguments (say f(x,y))
> and second which returns tuple (say def g(): return (xx,yy))
>
> my question is how to put returned values from g() as
> arguments to f ?
>
> the direct way generates error:
>
> f(g())
> TypeError: ff() takes exactly 2 arguments (1 given)
Use f(*g())
The * syntax does exactly what you want - it takes a single sequence and
interprets it as the full argument list.
Kent
More information about the Tutor
mailing list