I have a function inside a threaded object, this function accepts several parameters and I don't know if when many threads try to use this function this threads will change the parameter values of another thread?
I can use a lock but after the parameters have been assigned. If the parameters are stored in the stack I guess they will live inside each threads stack but if they live in heap how can avoid threads changing another threads function parameters?
def fib(x): return 1 if x <= 1 else fib(x-1) + fib(x-2)would give strange results if values of x lower in the call stack overwrote values of x higher up in the call stack.