Python参数传递

Posted by c cm on November 21, 2016

Python参数传递方式: call by sharing,means that each formal parameter of the function gets a copy of each reference in the arguments.

def f(a, b):
    a += b
    return a
>> a = (1, 2)
>> b = (3, 4)
>> f(a, b)
(1, 2, 3, 4)
>> a, b
>> (1, 2), (3, 4)

ref: Fluent Python