Passing every element of a list as argument to a function

Prasad, Ramit ramit.prasad at
Tue Aug 9 22:11:58 CEST 2011

-----Original Message-----
From: at [ at] On Behalf Of Antonio Vera
Sent: Tuesday, August 09, 2011 12:02 PM
To: python-list at
Subject: Passing every element of a list as argument to a function

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?

Thanks for your time.

op(*l) for a list (or positional arguments).

If you are trying to pass named keyword arguments then you must pass it a dictionary { 'keywordName' : 'value' }
>>>def F(name=None):


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at  

More information about the Python-list mailing list