Mixing positional and named parameters - order
We can also mix the parameters passed to any user-defined function, but we have to make sure that
positional parameters always come first and named (key-value) parameter come at the
end of the parameter list.
examples/functions/named_and_positional_params.py
def sendmail(From, To, Subject, Content): print('From:', From) print('To:', To) print('Subject:', Subject) print('') print(Content) sendmail( Subject = 'self message', Content = 'Has some content too', To = 'szabgab@gmail.com', 'gabor@szabgab.com', )
File "examples/functions/named_and_positional_params.py", line 14 'gabor@szabgab.com', ^ SyntaxError: positional argument follows keyword argument
examples/functions/positional_and_named_params.py
def sendmail(From, To, Subject, Content): print('From:', From) print('To:', To) print('Subject:', Subject) print('') print(Content) sendmail( 'gabor@szabgab.com', Subject = 'self message', Content = 'Has some content too', To = 'szabgab@gmail.com', )