If I have a function def f(a, b, c, d) and two tuples, each with two elements, is there any way to unpack these tuples so that I can send their values to the function?
f(*tup1, *tup2)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As of the release of Python 3.5.0, PEP 448 “Additional Unpacking Generalizations” makes the natural syntax for this valid Python:
In older versions of Python, you can need to concatenate the tuples together to provide a single expanded argument: