Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

threadpool python map

from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import as_completed
values = [2,3,4,5]
def square(n):
   return n * n

with ThreadPoolExecutor(max_workers = 3) as executor:
	results = executor.map(square, values:list)
	for result in as_completed(results):
      print(result)
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #threadpool #python #map
ADD COMMENT
Topic
Name
2+3 =