It is well known that in order to set the default value for a variable inside a function in Python, the following syntax is used:
def func(x = 0):
if x == 0:
print("x is equal to 0")
else:
print("x is not equal to 0")
So, if the function is called as such:
>>> func()
The result is
'x is equal to 0'
But when a similar method is used for marked variables, for example,
def func(*x = (0, 0)):
this leads to a syntax error. I tried to enable the syntax by doing (*x = 0, 0), but the same error occurs. Is it possible to initialize a marked variable with a default value?
source
share