Passing every element of a list as argument to a function
Chris Angelico
rosuav at gmail.com
Tue Aug 9 13:29:16 EDT 2011
On Tue, Aug 9, 2011 at 6:02 PM, Antonio Vera <chichimeco at gmail.com> wrote:
> Hi!,
> I have a very simple syntax question. I want to evaluate a library
> function f receiving an arbitrary number of arguments (like
> itertools.product), on the elements of a list l. This means that I
> want to compute f(l[0],l[1],...,l[len(l)-1]).
>
> Is there any operation "op" such that f(op(l)) will give the sequence
> of elements of l as arguments to f?
Yep!
f(*l)
Chris Angelico
More information about the Python-list
mailing list