print(f"a = {a}, b = {b}, c = {c}")
...
>>> foo(1, "python", [9, 8, 7])
a = 1, b = python, c = [9, 8,...>>> foo(1, [9, 8, 7], 'python')
a = 1, b = [9, 8, 7], c = python
不仅强调位置的顺序,对于类似于 foo() 那种形式的参数而言,对应的对象一个都不能少...关键词参数
如果像下面这样调用函数 foo() :
>>> foo(a=1, b='python', c=[9,8,7])
a = 1, b = python, c = [9, 8, 7]
>>> foo...(a=1, c=[9,8,7], b='python')
a = 1, b = python, c = [9, 8, 7]
将形参与实参绑定,则不论次序如何,对象的引用关系不受影响。...>>> foo(1, 'python', c=[9,8,7])
a = 1, b = python, c = [9, 8, 7]
特别要注意,在既有位置参数,又有关键词参数时,务必要将位置参数放在关键词参数前面