I'm passing a lot data around; specifically, I'm trying to pass the output of a function into a class and the output contains a tuple with three variables. I can't directly pass the output from my function (the tuple) into the class as in the input parameters.
How can format the tuple so it is accepted by the class without input_tuple[0], input_tuple[1], input_tuple[2]
?
Here is a simple example:
#!/usr/bin/python
class InputStuff(object):
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
input_tuple = (1, 2, 3)
instance_1 = InputStuff(input_tuple)
# Traceback (most recent call last):
# File "Untitled 3.py", line 7, in <module>
# instance_1 = InputStuff(input_tuple)
# TypeError: __init__() takes exactly 4 arguments (2 given)
InputStuff(1, 2, 3)
# This works