[3.6] bpo-35099: Update idlelib/help.html (GH-10353) by miss-islington · Pull Request #10355 · python/cpython

Expand Up @@ -616,23 +616,33 @@ <h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalin <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> Expand Down Expand Up @@ -752,7 +762,7 @@ <h3><a href="../contents.html">Table of Contents</a></h3> <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> Expand Down Expand Up @@ -841,7 +851,7 @@ <h3>Navigation</h3> <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 />
Expand Down