From 7d03c8463477b0e314f594bb9988e49dc0945be9 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 2 May 2016 18:17:19 -0400 Subject: [PATCH] Clarify IDLE-console differences with respect to the sys module. The reload(sys) effect was the crux of a Stackoverflow question. --- Doc/library/idle.rst | 16 +++++++++------- Lib/idlelib/help.html | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index df08fe8b5b1..84805ff21d2 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -550,14 +550,16 @@ IDLE-console differences As much as possible, the result of executing Python code with IDLE is the same as executing the same code in a console window. However, the different -interface and operation occasionally affects results. +interface and operation occasionally affects visible results. For instance, +``sys.modules`` starts with more entries. -For instance, IDLE normally executes user code in a separate process from -the IDLE GUI itself. The IDLE versions of sys.stdin, .stdout, and .stderr in the -execution process get input from and send output to the GUI process, -which keeps control of the keyboard and screen. This is normally transparent, -but code that access these object will see different attribute values. -Also, functions that directly access the keyboard and screen will not work. +IDLE also replaces ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` with +objects that get input from and send output to the Shell window. +When this window has the focus, it controls the keyboard and screen. +This is normally transparent, but functions that directly access the keyboard +and screen will not work. If ``sys`` is reset with ``reload(sys)``, +IDLE's changes are lost and things like ``input``, ``raw_input``, and +``print`` will not work correctly. With IDLE's Shell, one enters, edits, and recalls complete statements. Some consoles only work with a single physical line at a time. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 246e50062c9..7e79e6d679c 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -163,7 +163,7 @@ be undone.
Find Selection
Search for the currently selected string, if there is one.
Find in Files...
-
Open a file search dialog. Put results in an new output window.
+
Open a file search dialog. Put results in a new output window.
Replace...
Open a search-and-replace dialog.
Go to Line
@@ -517,13 +517,15 @@ set in the Options dialog.

24.6.3.2. IDLE-console differencesΒΆ

As much as possible, the result of executing Python code with IDLE is the same as executing the same code in a console window. However, the different -interface and operation occasionally affects results.

-

For instance, IDLE normally executes user code in a separate process from -the IDLE GUI itself. The IDLE versions of sys.stdin, .stdout, and .stderr in the -execution process get input from and send output to the GUI process, -which keeps control of the keyboard and screen. This is normally transparent, -but code that access these object will see different attribute values. -Also, functions that directly access the keyboard and screen will not work.

+interface and operation occasionally affects visible results. For instance, +sys.modules starts with more entries.

+

IDLE also replaces sys.stdin, sys.stdout, and sys.stderr with +objects that get input from and send output to the Shell window. +When this window has the focus, it controls the keyboard and screen. +This is normally transparent, but functions that directly access the keyboard +and screen will not work. If sys is reset with reload(sys), +IDLE’s changes are lost and things like input, raw_input, and +print will not work correctly.

With IDLE’s Shell, one enters, edits, and recalls complete statements. Some consoles only work with a single physical line at a time.

@@ -699,7 +701,7 @@ are currently:

The Python Software Foundation is a non-profit corporation. Please donate.
- Last updated on Mar 20, 2016. + Last updated on May 02, 2016. Found a bug?
Created using Sphinx 1.3.3.