@@ -563,7 +563,6 @@ looked for in the user's home directory. Statements in this file will be
563563executed in the Tk namespace, so this file is not useful for importing
564564functions to be used from IDLE's Python shell.
565565
566-
567566Command line usage
568567^^^^^^^^^^^^^^^^^^
569568
@@ -591,7 +590,6 @@ If there are arguments:
591590* Otherwise, arguments are files opened for editing and
592591 ``sys.argv `` reflects the arguments passed to IDLE itself.
593592
594-
595593Startup failure
596594^^^^^^^^^^^^^^^
597595
@@ -635,27 +633,38 @@ be to delete one or more of the configuration files.
635633If IDLE quits with no message, and it was not started from a console, try
636634starting from a console (``python -m idlelib) `` and see if a message appears.
637635
638-
639- IDLE-console differences
640- ^^^^^^^^^^^^^^^^^^^^^^^^
636+ Running user code
637+ ^^^^^^^^^^^^^^^^^
641638
642639With rare exceptions, the result of executing Python code with IDLE is
643- intended to be the same as executing the same code in a console window.
640+ intended to be the same as executing the same code by the default method,
641+ directly with Python in a text-mode system console or terminal window.
644642However, the different interface and operation occasionally affect
645- visible results. For instance, ``sys.modules `` starts with more entries.
643+ visible results. For instance, ``sys.modules `` starts with more entries,
644+ and ``threading.activeCount() `` returns 2 instead of 1.
645+
646+ By default, IDLE runs user code in a separate OS process rather than in
647+ the user interface process that runs the shell and editor. In the execution
648+ process, it replaces ``sys.stdin ``, ``sys.stdout ``, and ``sys.stderr ``
649+ with objects that get input from and send output to the Shell window.
650+ The original values stored in ``sys.__stdin__ ``, ``sys.__stdout__ ``, and
651+ ``sys.__stderr__ `` are not touched, but may be ``None ``.
646652
647- IDLE also replaces ``sys.stdin ``, ``sys.stdout ``, and ``sys.stderr `` with
648- objects that get input from and send output to the Shell window.
649653When Shell has the focus, it controls the keyboard and screen. This is
650654normally transparent, but functions that directly access the keyboard
651- and screen will not work. If ``sys `` is reset with ``importlib.reload(sys) ``,
652- IDLE's changes are lost and things like ``input ``, ``raw_input ``, and
653- ``print `` will not work correctly.
654-
655- With IDLE's Shell, one enters, edits, and recalls complete statements.
656- Some consoles only work with a single physical line at a time. IDLE uses
657- ``exec `` to run each statement. As a result, ``'__builtins__' `` is always
658- defined for each statement.
655+ and screen will not work. These include system-specific functions that
656+ determine whether a key has been pressed and if so, which.
657+
658+ IDLE's standard stream replacements are not inherited by subprocesses
659+ created in the execution process, whether directly by user code or by modules
660+ such as multiprocessing. If such subprocess use ``input `` from sys.stdin
661+ or ``print `` or ``write `` to sys.stdout or sys.stderr,
662+ IDLE should be started in a command line window. The secondary subprocess
663+ will then be attached to that window for input and output.
664+
665+ If ``sys `` is reset by user code, such as with ``importlib.reload(sys) ``,
666+ IDLE's changes are lost and input from the keyboard and output to the screen
667+ will not work correctly.
659668
660669Developing tkinter applications
661670^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 commit comments