Код: Выделить всё
import concurrent.futures
def f2():
print("hello, f2")
def f1():
print("hello, f1")
executor.submit(f2)
with concurrent.futures.ThreadPoolExecutor(16) as executor:
executor.submit(f1)
Код: Выделить всё
hello, f1
Код: Выделить всё
import concurrent.futures
def f2():
print("hello, f2")
return 3
def f1():
print("hello, f1")
print(executor.submit(f2).result())
with concurrent.futures.ThreadPoolExecutor(16) as executor:
executor.submit(f1)
Подробнее здесь: https://stackoverflow.com/questions/790 ... -submitted