Turns out, Python follows neither of the above. Python is “Pass by object reference” a.k.a object references are passed by value
Now put anomaly example here
import foobar
def foo(x):
print(x, id(x))
x +=10
print(x, id(x))
return x
a =10
print(a, id(a))
b = foo(a)
print(a, id(a)); print(b, id(b))
#why is the change in value not reflected in 'a'?
Well, it turns out that the variable ‘a’/’x’ was still passed by object reference. But since it is of type int (which is immutable); when it is changes the variable is assigned to a new memory location hence the change is not reflected outside the function