|
|
Before call, a = 1 b = 2 In function, ref = 10 value = 20 After call, a = 10 b = 2 |
|
|
|
|
def testFunction( alist1, alist2, scalar ): alist1, alist2[0], scalar = [10], 20, 30 print( "In function, alist1 = ", alist1, " alist2 = ", alist2, " scalar = ", scalar ) a, b, c = [ 1 ], [ 2 ], 3 print( "Before call, a = ", a, " b = ", b, " c = ", c ) testFunction( a, b, c ) print( "After call , a = ", a, " b = ", b, " c = ", c ) |
Before call, a = [1] b = [2] c = 3 In function, alist1 = [10] alist2 = [20] scalar = 30 After call , a = [1] b = [20] c = 3 |
|
|
|
|
In Python, it's just ... anarchic! |