0

Pass by reference is it available in Python?

How can you change a parametr value in a function and pass that back?

27th Apr 2017, 9:33 PM
SAMI Awad
SAMI Awad - avatar
1 Answer
+ 3
If you call a method of the object like so def appendTo(arr, el): arr.append(el) # Note here I called a method on the argument the changes are made in the argument you passed itself. But if you directly modify it, a copy will be made.
27th Apr 2017, 10:03 PM
Bebida Roja
Bebida Roja - avatar