What I'm trying to achieve here is changing the value of a name passed to a function, like in C#, one can pass a variable then any changes made to it persist even after execution. I was reading on name binding, and AFAIK, if one passes a name to a function, that function creates a name in its local namespace binded to the object passed by reference (everything in python is an object). Since i was working with lists, i thought of a work-around which is clearing the list, then extending it with another one (through mutable objects).
EXAMPLE:
def function(array):
#initial length
length = len(array)
#A bunch of code
#At this point of execution, list length should have changed greatly
array = array[length:]
#my workaround: temp = array[:length] ; array.clear() ; array.extend(temp)
return something_else
#Before execution list = [1,2,3]
function(var) # inside function, list = [4,5,6]
#After execution list = [1,2,3,4,5,6] #because i use list.append(x)
NOTE:
Is there any way to mimic that effect in case it's actually not possible.