First, I understand that while defining function you have to place positional arguments first and then default arguments to avoid the ambiguity situation for interpreter. That is why when we try to do it, it throws an error.
For e.g. in the following code, a and b cannot be evaluated at the runtime due to which it throws an error
def func(a=1,b):
return a+b
func(2)
(Error:non-default argument follows default argument
)
This is understandable.
But why does the following results in an error. It does not occur at the time of defining function but at the time of calling function.
def student(firstname, standard,lastname):
print(firstname, lastname, 'studies in', standard, 'Standard')
student(firstname ='John','Gates','Seventh')
Error:positional argument follows keyword argument
Can't we pass parameters with and without keywords simultaneously? [Edit]: The question is not a possible duplicates as the duplicates talk about the case when default arguments are defines. I've not defined them. I am just asking why can't we mix keyword value parameters and direct value parameters.