- Learn Web Development with Python
- Fabrizio Romano Gaston C. Hillar Arun Ravindran
- 81字
- 2021-06-10 18:26:11
Positional arguments
Positional arguments are read from left to right and they are the most common type of arguments:
# arguments.positional.py
def func(a, b, c):
print(a, b, c)
func(1, 2, 3) # prints: 1 2 3
There is not much else to say. They can be as numerous as you want and they are assigned by position. In the function call, 1 comes first, 2 comes second, and 3 comes third, therefore they are assigned to a, b, and c, respectively.