Jump to content

Python: Difference between revisions

4 bytes removed ,  11 December 2020
Line 339: Line 339:
def do_something(a, b):
def do_something(a, b):
   return a + b
   return a + b
 
 
futures = []
futures = []
for i in range(5):
for i in range(5):
   future = self.executor.submit(do_something, 1, 2+i)
   future = self.executor.submit(do_something, 1, 2+i)
   futures.append(future)
   futures.append(future)
 
 
while len(futures) > 0:
while len(futures) > 0:
   future = futures.pop()
   future = futures.pop()