No, arguments to functions are not treated special in any way. It's just another assignment (to the parameter names of the function).
If you need to treat a
and b
as separate arguments, make Test
a sequence, then pass it in with the *sequence
call syntax to expand the sequence to separate arguments. You can make it a sequence by making it an iterator type:
class Test:
def __init__(self, a, b):
self.a = a
self.b = b
def __iter__(self):
return iter((self.a, self.b))
test = Test(0, 1)
some_function(*test)
Demo:
>>> def some_function(a, b):
... print(f'a = {a!r}\nb = {b!r}')
...
>>> test = Test(0, 1)
>>> some_function(*test)
a = 0
b = 1