我习惯了C#Task.WhenAll函数。我想知道是否有一个等效的python&concurrent.futures.Future
我正在寻找类似的东西:
pool = concurrent.futures.ThreadPoolExecutor(2)
future1 = pool.submit(lambda : 1 + 1)
future2 = pool.submit(lambda : 1 + 2)
aggregated_future = when_all([future1, future2])
print aggregated_future.result() # print result as a list [2, 3]