concurrent.futures.as_completed()
concurrent.futures.as_completed() is a Python function in the Concurrent Module category. Returns an iterator yielding Futures as they complete (in completion order). The syntax is concurrent.futures.as_completed(futures, timeout=None). Returns: Iterator of Futures. A typical example: for future in as_completed(futures):
print(future.result()) # Process as each completes. A close sibling is concurrent.futures.ThreadPoolExecutor(), which creates a thread pool for executing callables asynchronously. A close sibling is concurrent.futures.ProcessPoolExecutor(), which creates a process pool for CPU-bound parallel execution. A close sibling is Executor.submit(), which schedules a callable to be executed and returns a Future. A close sibling is Executor.map(), which maps a function across iterables in parallel (like built-in map). More about this category: Thread/process pools — ThreadPoolExecutor, ProcessPoolExecutor, Future. Related Concurrent Module entries: concurrent.futures.ThreadPoolExecutor(), concurrent.futures.ProcessPoolExecutor(), Executor.submit(), Executor.map(), Future.result(), Future.done(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.