So I have some code that is being somewhat troublesome to rewrite:
def func_A():
x=[]
# the function picks random members of the local x and rearranges them,
# after giving x some initial value
return x
Now I want to create an iteration in a func_B such that, for each run-through in an interation, func_B uses the x value that func_A generates to do things.
However, I want to avoid making x a global variable.
My first thought was to make the first line of the def of func_B x=func_A(), but this would run the randomizer twice and the value of x would be changed.
How do I reference the same x that func_A produces in func_B without running the randomizer again (until the next iteration in func_B) and without using global variables?
Use Classes
Think this is what you meant?