Detupleize a tuple for argument list

Luke Plant L.Plant.98 at cantab.net
Wed Jul 5 08:19:35 EDT 2006


Marco Wahl wrote:
> Hi,
>
> I want to give a tuple to a function where the function
> expects the respective tuple-size number of arguments.
...
> One way to do what I want is--of course--to call
> foo(t[0], t[1]).  My actual question is if there is a
> smarter way to do it.

Yes, just this:

  foo(*t)

Luke




More information about the Python-list mailing list