aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2018-11-05 22:17:57 -0500
committerGitHub <noreply@github.com>2018-11-05 22:17:57 -0500
commitf1d3efc2fba704692d539acc3cb0376a1dd9d98f (patch)
treed8bafafbc24c7b80cbc418e23ddac5aa95558b94
parent bpo-35099: Improve the doc about IDLE running user code. (#10350) (diff)
downloadcpython-f1d3efc2fba704692d539acc3cb0376a1dd9d98f.tar.gz
cpython-f1d3efc2fba704692d539acc3cb0376a1dd9d98f.tar.bz2
cpython-f1d3efc2fba704692d539acc3cb0376a1dd9d98f.zip
bpo-35099: Update idlelib/help.html (#10353)
(This should have been done with the first PR for this issue.)
-rw-r--r--Lib/idlelib/help.html42
1 files changed, 26 insertions, 16 deletions
diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html
index 24fd77da904..1cd9b6913de 100644
--- a/Lib/idlelib/help.html
+++ b/Lib/idlelib/help.html
@@ -616,23 +616,33 @@ be to delete one or more of the configuration files.</p>
<p>If IDLE quits with no message, and it was not started from a console, try
starting from a console (<code class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">idlelib)</span></code> and see if a message appears.</p>
</div>
-<div class="section" id="idle-console-differences">
-<h3>IDLE-console differences<a class="headerlink" href="#idle-console-differences" title="Permalink to this headline">¶</a></h3>
+<div class="section" id="running-user-code">
+<h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline">¶</a></h3>
<p>With rare exceptions, the result of executing Python code with IDLE is
-intended to be the same as executing the same code in a console window.
+intended to be the same as executing the same code by the default method,
+directly with Python in a text-mode system console or terminal window.
However, the different interface and operation occasionally affect
-visible results. For instance, <code class="docutils literal notranslate"><span class="pre">sys.modules</span></code> starts with more entries.</p>
-<p>IDLE also replaces <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>, and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code> with
-objects that get input from and send output to the Shell window.
-When Shell has the focus, it controls the keyboard and screen. This is
+visible results. For instance, <code class="docutils literal notranslate"><span class="pre">sys.modules</span></code> starts with more entries,
+and <code class="docutils literal notranslate"><span class="pre">threading.activeCount()</span></code> returns 2 instead of 1.</p>
+<p>By default, IDLE runs user code in a separate OS process rather than in
+the user interface process that runs the shell and editor. In the execution
+process, it replaces <code class="docutils literal notranslate"><span class="pre">sys.stdin</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>, and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>
+with objects that get input from and send output to the Shell window.
+The original values stored in <code class="docutils literal notranslate"><span class="pre">sys.__stdin__</span></code>, <code class="docutils literal notranslate"><span class="pre">sys.__stdout__</span></code>, and
+<code class="docutils literal notranslate"><span class="pre">sys.__stderr__</span></code> are not touched, but may be <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
+<p>When Shell 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 <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
-IDLE’s changes are lost and things like <code class="docutils literal notranslate"><span class="pre">input</span></code>, <code class="docutils literal notranslate"><span class="pre">raw_input</span></code>, and
-<code class="docutils literal notranslate"><span class="pre">print</span></code> will not work correctly.</p>
-<p>With IDLE’s Shell, one enters, edits, and recalls complete statements.
-Some consoles only work with a single physical line at a time. IDLE uses
-<code class="docutils literal notranslate"><span class="pre">exec</span></code> to run each statement. As a result, <code class="docutils literal notranslate"><span class="pre">'__builtins__'</span></code> is always
-defined for each statement.</p>
+and screen will not work. These include system-specific functions that
+determine whether a key has been pressed and if so, which.</p>
+<p>IDLE’s standard stream replacements are not inherited by subprocesses
+created in the execution process, whether directly by user code or by modules
+such as multiprocessing. If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from sys.stdin
+or <code class="docutils literal notranslate"><span class="pre">print</span></code> or <code class="docutils literal notranslate"><span class="pre">write</span></code> to sys.stdout or sys.stderr,
+IDLE should be started in a command line window. The secondary subprocess
+will then be attached to that window for input and output.</p>
+<p>If <code class="docutils literal notranslate"><span class="pre">sys</span></code> is reset by user code, such as with <code class="docutils literal notranslate"><span class="pre">importlib.reload(sys)</span></code>,
+IDLE’s changes are lost and input from the keyboard and output to the screen
+will not work correctly.</p>
</div>
<div class="section" id="developing-tkinter-applications">
<h3>Developing tkinter applications<a class="headerlink" href="#developing-tkinter-applications" title="Permalink to this headline">¶</a></h3>
@@ -752,7 +762,7 @@ also used for testing.</p>
<li><a class="reference internal" href="#startup-and-code-execution">Startup and code execution</a><ul>
<li><a class="reference internal" href="#command-line-usage">Command line usage</a></li>
<li><a class="reference internal" href="#startup-failure">Startup failure</a></li>
-<li><a class="reference internal" href="#idle-console-differences">IDLE-console differences</a></li>
+<li><a class="reference internal" href="#running-user-code">Running user code</a></li>
<li><a class="reference internal" href="#developing-tkinter-applications">Developing tkinter applications</a></li>
<li><a class="reference internal" href="#running-without-a-subprocess">Running without a subprocess</a></li>
</ul>
@@ -841,7 +851,7 @@ also used for testing.</p>
<br />
<br />
- Last updated on Oct 28, 2018.
+ Last updated on Nov 05, 2018.
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
<br />