Flatten a list/tuple and Call a function with tuples
beginner
zyzhu2000 at gmail.com
Wed Jul 25 21:01:40 EDT 2007
> Well, there are several ways to solve this. You could either invoke f(*g
> () + (10,)). Might be a bit nasty and unreadable, though. Or you could
> just change your function f to accept them in reversed order (f(10, *g)
> should work) or convert g() to return a dictionary like {'b': 1, 'c': 2}
> and use f(10, **g). But if your function f's hugest use case is being
> called with g(), changing f to accept something and g's result (tuple) --
> unpacking it inside f -- might be better.- Hide quoted text -
>
> - Show quoted text -
These all work. Thanks.
More information about the Python-list
mailing list