# =================================================================== # Arguments Passed to Function # =================================================================== # Python uses a mechanism, which is known as "Call-by-Object", # sometimes also called "Call by Object Reference" or "Call by # Sharing". If you pass immutable arguments like integers, # strings or tuples to a function, the passing acts like # call-by-value. ... It's different, if we pass mutable arguments. # =================================================================== def func(x): x[1][2] = 1000 xx = x[1] xx[1] = 'abc' print('func : x = {}'.format(x)) return l = [10,20,30] # list - mutable i = (1,l,3) # tuple - immutable print('before: i = {} {}'.format(i,type(i))) func(i) print('after : i = {} {}'.format(i,type(i)))