No. This is not possible. The Python interpreter thinks that you want to assign the default value of argument b
to a global variable a
when there isn't a global variable a
.
You might want to try something like this:
def func(a, b=None):
if b is None:
b = a