Module 4 · How functions communicate with their environment · Lesson 4 of 5
Mixing positional and keyword
You don't have to choose one style — you can mix positional and keyword arguments in a single call. It's common to pass the first, obvious value positionally and then name the rest for clarity. There's just one rule, and Python enforces it strictly.
The rule: every positional argument must come before any keyword argument. Once you've started naming arguments, you can't go back to bare positional ones — Python would no longer know which parameter the bare value belongs to.
The good arrangement reads naturally; the bad one stops the program before it even runs, with a SyntaxError. The fix is always the same: move the positional arguments to the front, or give them names too.
That's the complete picture of passing data into a function: parameters as slots, arguments by position or by name, and how to combine them. A short quiz to lock it in.