Skip to content

Commit f1d3efc

Browse files
authored
bpo-35099: Update idlelib/help.html (python#10353)
(This should have been done with the first PR for this issue.)
1 parent 5e79090 commit f1d3efc

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

Lib/idlelib/help.html

+26-16
Original file line numberDiff line numberDiff line change
@@ -616,23 +616,33 @@ <h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalin
616616
<p>If IDLE quits with no message, and it was not started from a console, try
617617
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>
618618
</div>
619-
<div class="section" id="idle-console-differences">
620-
<h3>IDLE-console differences<a class="headerlink" href="#idle-console-differences" title="Permalink to this headline"></a></h3>
619+
<div class="section" id="running-user-code">
620+
<h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline"></a></h3>
621621
<p>With rare exceptions, the result of executing Python code with IDLE is
622-
intended to be the same as executing the same code in a console window.
622+
intended to be the same as executing the same code by the default method,
623+
directly with Python in a text-mode system console or terminal window.
623624
However, the different interface and operation occasionally affect
624-
visible results. For instance, <code class="docutils literal notranslate"><span class="pre">sys.modules</span></code> starts with more entries.</p>
625-
<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
626-
objects that get input from and send output to the Shell window.
627-
When Shell has the focus, it controls the keyboard and screen. This is
625+
visible results. For instance, <code class="docutils literal notranslate"><span class="pre">sys.modules</span></code> starts with more entries,
626+
and <code class="docutils literal notranslate"><span class="pre">threading.activeCount()</span></code> returns 2 instead of 1.</p>
627+
<p>By default, IDLE runs user code in a separate OS process rather than in
628+
the user interface process that runs the shell and editor. In the execution
629+
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>
630+
with objects that get input from and send output to the Shell window.
631+
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
632+
<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>
633+
<p>When Shell has the focus, it controls the keyboard and screen. This is
628634
normally transparent, but functions that directly access the keyboard
629-
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>,
630-
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
631-
<code class="docutils literal notranslate"><span class="pre">print</span></code> will not work correctly.</p>
632-
<p>With IDLE’s Shell, one enters, edits, and recalls complete statements.
633-
Some consoles only work with a single physical line at a time. IDLE uses
634-
<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
635-
defined for each statement.</p>
635+
and screen will not work. These include system-specific functions that
636+
determine whether a key has been pressed and if so, which.</p>
637+
<p>IDLE’s standard stream replacements are not inherited by subprocesses
638+
created in the execution process, whether directly by user code or by modules
639+
such as multiprocessing. If such subprocess use <code class="docutils literal notranslate"><span class="pre">input</span></code> from sys.stdin
640+
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,
641+
IDLE should be started in a command line window. The secondary subprocess
642+
will then be attached to that window for input and output.</p>
643+
<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>,
644+
IDLE’s changes are lost and input from the keyboard and output to the screen
645+
will not work correctly.</p>
636646
</div>
637647
<div class="section" id="developing-tkinter-applications">
638648
<h3>Developing tkinter applications<a class="headerlink" href="#developing-tkinter-applications" title="Permalink to this headline"></a></h3>
@@ -752,7 +762,7 @@ <h3><a href="../contents.html">Table of Contents</a></h3>
752762
<li><a class="reference internal" href="#startup-and-code-execution">Startup and code execution</a><ul>
753763
<li><a class="reference internal" href="#command-line-usage">Command line usage</a></li>
754764
<li><a class="reference internal" href="#startup-failure">Startup failure</a></li>
755-
<li><a class="reference internal" href="#idle-console-differences">IDLE-console differences</a></li>
765+
<li><a class="reference internal" href="#running-user-code">Running user code</a></li>
756766
<li><a class="reference internal" href="#developing-tkinter-applications">Developing tkinter applications</a></li>
757767
<li><a class="reference internal" href="#running-without-a-subprocess">Running without a subprocess</a></li>
758768
</ul>
@@ -841,7 +851,7 @@ <h3>Navigation</h3>
841851
<br />
842852
<br />
843853

844-
Last updated on Oct 28, 2018.
854+
Last updated on Nov 05, 2018.
845855
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
846856
<br />
847857

0 commit comments

Comments
 (0)