I disagree with you here, it works that way for numbers and strings only in python. Other objects have the same behavior as variables here.
In your case you pass an object and modify one of it’s field (.data in that case), it’s like working with a list (or dict) and modifying one of it’s elements:
a=[1]
def function(a):
     a[0] = 2
     return a
print function(a)
print a

Actually any python object that can contain a subfield like .data will always have this behavior.