from concurrent.futures.thread import ThreadPoolExecutor executor = ThreadPoolExecutor() def f(n): for i in range(n): executor.submit(lambda: None).result() import sys f(int(sys.argv[1]))