@@ -11,9 +11,10 @@ module.
1111
1212This document has 2 parts: first a brief introduction and then a tutorial.
1313
14- The tutorial covers the basics of using multiple interpreters
15- (:ref: `interp-tutorial-basics `), as well as how to communicate between
16- interpreters (:ref: `interp-tutorial-communicating `).
14+ The tutorial covers :ref: `the basics <interp-tutorial-basics >` of using
15+ multiple interpreters, as well as how :ref: `to communicate
16+ <interp-tutorial-communicating>` between interpreters. It finishes with
17+ some :ref: `extra information <interp-tutorial-misc >`.
1718
1819.. currentmodule :: concurrent.interpreters
1920
@@ -620,24 +621,6 @@ can explicitly clean it up sooner::
620621 finally:
621622 interp.close()
622623
623- concurrent.futures.InterpreterPoolExecutor
624- ------------------------------------------
625-
626- The :mod: `concurrent.futures ` module is a simple, popular concurrency
627- framework that wraps both threading and multiprocessing. You can also
628- use it with multiple interpreters, via
629- :class: `~concurrent.futures.InterpreterPoolExecutor `::
630-
631- from concurrent.futures import InterpreterPoolExecutor
632-
633- def script():
634- return 'spam!'
635-
636- with InterpreterPoolExecutor(max_workers=5) as executor:
637- fut = executor.submit(script)
638- res = fut.result()
639- # res: 'spam!'
640-
641624
642625.. _interp-tutorial-communicating :
643626
@@ -1015,6 +998,30 @@ You can also close the pipe ends and join the thread to synchronize.
1015998Using :func: `os.pipe ` (or similar) to communicate between interpreters
1016999is a little awkward, as well as inefficient.
10171000
1001+
1002+ .. _interp-tutorial-misc :
1003+
1004+ Tutorial: Miscellaneous
1005+ =======================
1006+
1007+ concurrent.futures.InterpreterPoolExecutor
1008+ ------------------------------------------
1009+
1010+ The :mod: `concurrent.futures ` module is a simple, popular concurrency
1011+ framework that wraps both threading and multiprocessing. You can also
1012+ use it with multiple interpreters, via
1013+ :class: `~concurrent.futures.InterpreterPoolExecutor `::
1014+
1015+ from concurrent.futures import InterpreterPoolExecutor
1016+
1017+ def script():
1018+ return 'spam!'
1019+
1020+ with InterpreterPoolExecutor(max_workers=5) as executor:
1021+ fut = executor.submit(script)
1022+ res = fut.result()
1023+ # res: 'spam!'
1024+
10181025Capturing an interpreter's stdout
10191026---------------------------------
10201027
0 commit comments