Jun-18-2020, 07:29 AM
You're calling the function talk directly and the return value of talk is called by executor, but the returned
This will fix your code.
Function signature of threading.Thread
Very simplified the
str
is not callable. The executor needs to call the function. The name of a function is the reference to the function object living in memory. You can use also function as arguments.This will fix your code.
future = executor.submit(talk, 'This will be, a long text for testing purpose.')Function signature of Executor.submit
Function signature of threading.Thread
Very simplified the
executor.submit
looks like this:def submit(function, *args, **kwargs): return fuction(*args, **kwargs)The function submit calls the supplied function with arguments and keyword arguments.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!