How do I write a function with output parameters (call by reference)?
Python doesn’t support call by reference; a called function only has access to the argument values (the actual objects), not the variables in the calling scope.
To return multiple values, you can simply return a tuple, and use sequence unpacking at the call site:
def func(a, b): a = 'new-value' # a and b are local names b = b + 1 # assigned to new objects return a, b # return new values x, y = 'old-value', 99 x, y =