I’m trying to do something like this:
import threading
def func1(a,b):
def func2():
t=threading.Thread(target=func3)
return t
return func2
func2=func1(a,b)
func2()
I have a restriction(the language I’m using is python with some restricted functions) not to use the args parameter for the Thread function instead I want to pass a and b as parameters to func3. How can I do this using closures?
In the absence of
lambdaI might look intofunctools.partial. If that isn’t allowed, you could probably do: