def fn(a=55,b):
print(a,b)
fn(1,2)
This is a python code. After running this error occurred:
SyntaxError: non-default argument follows default argument
def fn(a=55,b):
print(a,b)
fn(1,2)
This is a python code. After running this error occurred:
SyntaxError: non-default argument follows default argument
In the function definition, default arguments come after non-default arguments. You can read more about Function Definitions in Python Docs:
When one or more parameters have the form parameter
=expression, the function is said to have default parameter values. For a parameter with a default value, the corresponding argument may be omitted from a call, in which case the parameter’s default value is substituted. If a parameter has a default value, all following parameters up until the*must also have a default value — this is a syntactic restriction that is not expressed by the grammar.
In your case, b (non-default) must be defined prior to a=55 (default).
def fn(b, a=55):
print(a, b)
fn(1, 2)