def F1():
myvar = 1
myArrayVar = []
def F2():
global myvar, myArrayVar # this will be changed by F2()
myvar = 2
myArrayVar.append(myVar)
print(myvar)
F2()
F1()
So I have a function inside a function. Since F2() is recursive, I have to store variables outside.
In C I would separate both or pass pointers, in Java I would create objects. But is there anyway in Python that allows me to do this quickly without much changes? I don't want to use global variables, myvar needs to be kept within the context of F1()
Thank you.