Executor.submit()
Executor.submit() is a Python method in the Concurrent Module category. Schedules a callable to be executed and returns a Future. The syntax is executor.submit(fn, /, *args, **kwargs). Parameters: fn — callable. Returns: Future object. A typical example: future = executor.submit(pow, 2, 10)
result = future.result() # 1024. 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.map(), which maps a function across iterables in parallel (like built-in map). A close sibling is Future.result(), which returns the result of the callable when complete. Blocks if not yet done. More about this category: Thread/process pools — ThreadPoolExecutor, ProcessPoolExecutor, Future. Related Concurrent Module entries: concurrent.futures.ThreadPoolExecutor(), concurrent.futures.ProcessPoolExecutor(), Executor.map(), Future.result(), Future.done(), Future.cancel(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.