In the following codes there are two places which asterisk(*) is used :
Asterisk in function:
def function(*asterisk):
print(1, type(asterisk))
Asterisk in expressions:
a, *b = (1, 2, 3)
print(2, type(b))
a, *b = [1, 2, 3]
print(3, type(b))
I know the meaning of asterisk in functions and how it works.
My question is why asterisk in print number 1 has a tuple type whereas in print number 2 and 3 has a list type ?
Why python interprets function *parameter as tuple regardless of argument's type and interprets *variable as list regardless of assigned numbers' type in expressions?
In the end, are those * different operators?!