What is the difference between arguments and parameters?
PythonLevel: Intermediate
What is the difference between arguments and parameters?
Hints
- Identify object types, mutability and execution order.
- Trace a minimal example: which values and references change?
Answer
Parameters are defined by the names that appear in a function definition, whereas arguments are the values actually passed to a function when calling it. Parameters define what kind of arguments a function can accept. For example, given the function definition:
def func(foo, bar=None, **kwargs):
pass
foo, bar and kwargs are parameters of func. However, when calling
func, for example:
func(42, bar=314, extra=somevar)
the values 42, 314, and somevar are arguments.
Source and licence: Python 3.14.0 Programming FAQ — Python Software Foundation · PSF-2.0