0

I have a function (func1) that returns a 4-tuple of mixed strings and integers. I want to immediately pass these 4 values into a second function (func2). This is how I am doing it now:

var1, var2, var3, var4 = func1(input1)
func2(var1, var2, var3, var4)

Functions don't unpack tuples when given as input, so this code is broken:

func2(func1(input1))

Is there a pythonic way to implement this code in the style of the second code block so func2 will unpack the values or some equivalent?

1
  • 3
    func2(*func1(input1))? Commented Jul 8, 2016 at 12:30

1 Answer 1

4

Use the * operator:

func2(*func1(input1))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.