Skip to content

Commit 5100030

Browse files
Commit
1 parent 5f91d5d commit 5100030

File tree

2 files changed

+82
-36
lines changed

2 files changed

+82
-36
lines changed

Doc/library/idle.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ IDLE --- Python editor and shell
1313
single: Integrated Development Environment
1414

1515
..
16-
Remember to update Lib/idlelib/help.html with idlelib.help.copy_source() when modifying this file.
16+
Remember to update Lib/idlelib/help.html with idlelib.help.copy_strip() when modifying this file.
1717
1818
--------------
1919

@@ -88,7 +88,7 @@ Save
8888

8989
Save As...
9090
Save the current window with a Save As dialog. The file saved becomes the
91-
new associated file for the window. (If your file namager is set to hide
91+
new associated file for the window. (If your file manager is set to hide
9292
extensions, the current extension will be omitted in the file name box.
9393
If the new filename has no '.', '.py' and '.txt' will be added for Python
9494
and text files, except that on macOS Aqua,'.py' is added for all files.)
@@ -204,9 +204,9 @@ New Indent Width
204204
Open a dialog to change indent width. The accepted default by the Python
205205
community is 4 spaces.
206206

207-
Strip Trailing Chitespace
207+
Strip Trailing Whitespace
208208
Remove trailing space and other whitespace characters after the last
209-
non-whitespace character of a line by applying str.rstrip to each line,
209+
non-whitespace character of a line by applying :meth:`str.rstrip` to each line,
210210
including lines within multiline strings. Except for Shell windows,
211211
remove extra newlines at the end of the file.
212212

Lib/idlelib/help.html

Lines changed: 78 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h3>File menu (Shell and Editor)<a class="headerlink" href="#file-menu-shell-and
5353
do Save As instead.</p>
5454
</dd>
5555
<dt>Save As…</dt><dd><p>Save the current window with a Save As dialog. The file saved becomes the
56-
new associated file for the window. (If your file namager is set to hide
56+
new associated file for the window. (If your file manager is set to hide
5757
extensions, the current extension will be omitted in the file name box.
5858
If the new filename has no ‘.’, ‘.py’ and ‘.txt’ will be added for Python
5959
and text files, except that on macOS Aqua,’.py’ is added for all files.)</p>
@@ -143,8 +143,8 @@ <h3>Edit menu (Shell and Editor)<a class="headerlink" href="#edit-menu-shell-and
143143
<dt>New Indent Width</dt><dd><p>Open a dialog to change indent width. The accepted default by the Python
144144
community is 4 spaces.</p>
145145
</dd>
146-
<dt>Strip Trailing Chitespace</dt><dd><p>Remove trailing space and other whitespace characters after the last
147-
non-whitespace character of a line by applying str.rstrip to each line,
146+
<dt>Strip Trailing Whitespace</dt><dd><p>Remove trailing space and other whitespace characters after the last
147+
non-whitespace character of a line by applying <a class="reference internal" href="stdtypes.html#str.rstrip" title="str.rstrip"><code class="xref py py-meth docutils literal notranslate"><span class="pre">str.rstrip()</span></code></a> to each line,
148148
including lines within multiline strings. Except for Shell windows,
149149
remove extra newlines at the end of the file.</p>
150150
</dd>
@@ -337,16 +337,16 @@ <h3>Key bindings<a class="headerlink" href="#key-bindings" title="Link to this h
337337
assume that the keys have not been re-bound to something else.)</p>
338338
<ul class="simple">
339339
<li><p>Arrow keys move the cursor one character or line.</p></li>
340-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd></kbd> moves left or right one word.</p></li>
340+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd> and <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd> moves left or right one word.</p></li>
341341
<li><p><kbd class="kbd docutils literal notranslate">Home</kbd> and <kbd class="kbd docutils literal notranslate">End</kbd> go to the beginning or end of the line.</p></li>
342342
<li><p><kbd class="kbd docutils literal notranslate">Page Up</kbd> and <kbd class="kbd docutils literal notranslate">Page Down</kbd> go up or down one screen.</p></li>
343-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd></kbd> go to beginning or end of the file.</p></li>
344-
<li><p><kbd class="kbd docutils literal notranslate">Backspace</kbd> and <kbd class="kbd docutils literal notranslate">Del</kbd> (or <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd>) delete the previous
343+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd> and <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd> go to beginning or end of the file.</p></li>
344+
<li><p><kbd class="kbd docutils literal notranslate">Backspace</kbd> and <kbd class="kbd docutils literal notranslate">Del</kbd> (or <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd>) delete the previous
345345
or next character.</p></li>
346-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd></kbd> delete one word left or right.</p></li>
347-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd></kbd> deletes (‘kills’) everything to the right.</p></li>
346+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd> and <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd> delete one word left or right.</p></li>
347+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd> deletes (‘kills’) everything to the right.</p></li>
348348
</ul>
349-
<p>Standard keybindings (like <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> to copy and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">v</kbd></kbd> to paste)
349+
<p>Standard keybindings (like <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd> to copy and <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">v</kbd> to paste)
350350
may work. Keybindings are selected in the Configure IDLE dialog.</p>
351351
</section>
352352
<section id="automatic-indentation">
@@ -390,7 +390,7 @@ <h3>Search and Replace<a class="headerlink" href="#search-and-replace" title="Li
390390
directory name and a separator.</p>
391391
<p>Instead of waiting, or after a box is closed, open a completion box
392392
immediately with Show Completions on the Edit menu. The default hot
393-
key is <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">space</kbd></kbd>. If one types a prefix for the desired name
393+
key is <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">space</kbd>. If one types a prefix for the desired name
394394
before opening the box, the first match or near miss is made visible.
395395
The result is the same as if one enters a prefix
396396
after the box is displayed. Show Completions after a quote completes
@@ -473,9 +473,9 @@ <h3>Shell window<a class="headerlink" href="#shell-window" title="Link to this h
473473
<p>The editing features described in previous subsections work when entering
474474
code interactively. IDLE’s Shell window also responds to the following:</p>
475475
<ul class="simple">
476-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> attempts to interrupt statement execution (but may fail).</p></li>
477-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> closes Shell if typed at a <code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code> prompt.</p></li>
478-
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> (<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> on macOS)
476+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd> attempts to interrupt statement execution (but may fail).</p></li>
477+
<li><p><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd> closes Shell if typed at a <code class="docutils literal notranslate"><span class="pre">&gt;&gt;&gt;</span></code> prompt.</p></li>
478+
<li><p><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd> and <kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd> (<kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd> and <kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd> on macOS)
479479
retrieve to the current prompt the previous or next previously
480480
entered statement that matches anything already typed.</p></li>
481481
<li><p><kbd class="kbd docutils literal notranslate">Return</kbd> while the cursor is on any previous statement
@@ -517,27 +517,73 @@ <h2>Startup and Code Execution<a class="headerlink" href="#startup-and-code-exec
517517
functions to be used from IDLE’s Python shell.</p>
518518
<section id="command-line-usage">
519519
<h3>Command line usage<a class="headerlink" href="#command-line-usage" title="Link to this heading"></a></h3>
520-
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ...
521-
522-
-c command run command in the shell window
523-
-d enable debugger and open shell window
524-
-e open editor window
525-
-h print help message with legal combinations and exit
526-
-i open shell window
527-
-r file run file in shell window
528-
-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window
529-
-t title set title of shell window
530-
- run stdin in shell (- must be last option before args)
520+
<p>IDLE can be invoked from the command line with various options. The general syntax is:</p>
521+
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python<span class="w"> </span>-m<span class="w"> </span>idlelib<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span><span class="o">[</span>file<span class="w"> </span>...<span class="o">]</span>
531522
</pre></div>
532523
</div>
533-
<p>If there are arguments:</p>
524+
<p>The following options are available:</p>
525+
<dl class="std option">
526+
<dt class="sig sig-object std" id="cmdoption-idle-c">
527+
<span class="sig-name descname"><span class="pre">-c</span></span><span class="sig-prename descclassname"> <span class="pre">&lt;command&gt;</span></span><a class="headerlink" href="#cmdoption-idle-c" title="Link to this definition"></a></dt>
528+
<dd><p>Run the specified Python command in the shell window.
529+
For example, pass <code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">&quot;print('Hello,</span> <span class="pre">World!')&quot;</span></code>.
530+
On Windows, the outer quotes must be double quotes as shown.</p>
531+
</dd></dl>
532+
533+
<dl class="std option">
534+
<dt class="sig sig-object std" id="cmdoption-idle-d">
535+
<span class="sig-name descname"><span class="pre">-d</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-d" title="Link to this definition"></a></dt>
536+
<dd><p>Enable the debugger and open the shell window.</p>
537+
</dd></dl>
538+
539+
<dl class="std option">
540+
<dt class="sig sig-object std" id="cmdoption-idle-e">
541+
<span class="sig-name descname"><span class="pre">-e</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-e" title="Link to this definition"></a></dt>
542+
<dd><p>Open an editor window.</p>
543+
</dd></dl>
544+
545+
<dl class="std option">
546+
<dt class="sig sig-object std" id="cmdoption-idle-h">
547+
<span class="sig-name descname"><span class="pre">-h</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-h" title="Link to this definition"></a></dt>
548+
<dd><p>Print a help message with legal combinations of options and exit.</p>
549+
</dd></dl>
550+
551+
<dl class="std option">
552+
<dt class="sig sig-object std" id="cmdoption-idle-i">
553+
<span class="sig-name descname"><span class="pre">-i</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-i" title="Link to this definition"></a></dt>
554+
<dd><p>Open a shell window.</p>
555+
</dd></dl>
556+
557+
<dl class="std option">
558+
<dt class="sig sig-object std" id="cmdoption-idle-r">
559+
<span class="sig-name descname"><span class="pre">-r</span></span><span class="sig-prename descclassname"> <span class="pre">&lt;file&gt;</span></span><a class="headerlink" href="#cmdoption-idle-r" title="Link to this definition"></a></dt>
560+
<dd><p>Run the specified file in the shell window.</p>
561+
</dd></dl>
562+
563+
<dl class="std option">
564+
<dt class="sig sig-object std" id="cmdoption-idle-s">
565+
<span class="sig-name descname"><span class="pre">-s</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-s" title="Link to this definition"></a></dt>
566+
<dd><p>Run the startup file (as defined by the environment variables <span class="target" id="index-7"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">IDLESTARTUP</span></code> or <span class="target" id="index-8"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONSTARTUP"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONSTARTUP</span></code></a>) before opening the shell window.</p>
567+
</dd></dl>
568+
569+
<dl class="std option">
570+
<dt class="sig sig-object std" id="cmdoption-idle-t">
571+
<span class="sig-name descname"><span class="pre">-t</span></span><span class="sig-prename descclassname"> <span class="pre">&lt;title&gt;</span></span><a class="headerlink" href="#cmdoption-idle-t" title="Link to this definition"></a></dt>
572+
<dd><p>Set the title of the shell window.</p>
573+
</dd></dl>
574+
575+
<dl class="std option">
576+
<dt class="sig sig-object std" id="cmdoption-idle-0">
577+
<span class="sig-name descname"><span class="pre">-</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-idle-0" title="Link to this definition"></a></dt>
578+
<dd><p>Read and execute standard input in the shell window. This option must be the last one before any arguments.</p>
579+
</dd></dl>
580+
581+
<p>If arguments are provided:</p>
534582
<ul class="simple">
535-
<li><p>If <code class="docutils literal notranslate"><span class="pre">-</span></code>, <code class="docutils literal notranslate"><span class="pre">-c</span></code>, or <code class="docutils literal notranslate"><span class="pre">r</span></code> is used, all arguments are placed in
536-
<code class="docutils literal notranslate"><span class="pre">sys.argv[1:...]</span></code> and <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is set to <code class="docutils literal notranslate"><span class="pre">''</span></code>, <code class="docutils literal notranslate"><span class="pre">'-c'</span></code>,
537-
or <code class="docutils literal notranslate"><span class="pre">'-r'</span></code>. No editor window is opened, even if that is the default
538-
set in the Options dialog.</p></li>
539-
<li><p>Otherwise, arguments are files opened for editing and
540-
<code class="docutils literal notranslate"><span class="pre">sys.argv</span></code> reflects the arguments passed to IDLE itself.</p></li>
583+
<li><p>If <code class="docutils literal notranslate"><span class="pre">-</span></code>, <code class="docutils literal notranslate"><span class="pre">-c</span></code>, or <code class="docutils literal notranslate"><span class="pre">-r</span></code> is used, all arguments are placed in <code class="docutils literal notranslate"><span class="pre">sys.argv[1:]</span></code>,
584+
and <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code> is set to <code class="docutils literal notranslate"><span class="pre">''</span></code>, <code class="docutils literal notranslate"><span class="pre">'-c'</span></code>, or <code class="docutils literal notranslate"><span class="pre">'-r'</span></code> respectively.
585+
No editor window is opened, even if that is the default set in the <em>Options</em> dialog.</p></li>
586+
<li><p>Otherwise, arguments are treated as files to be opened for editing, and <code class="docutils literal notranslate"><span class="pre">sys.argv</span></code> reflects the arguments passed to IDLE itself.</p></li>
541587
</ul>
542588
</section>
543589
<section id="startup-failure">
@@ -798,7 +844,7 @@ <h3>Extensions<a class="headerlink" href="#extensions" title="Link to this headi
798844
either in idlelib or click Help =&gt; About IDLE on the IDLE menu. This
799845
file also maps IDLE menu items to the code that implements the item.
800846
Except for files listed under ‘Startup’, the idlelib code is ‘private’ in
801-
sense that feature changes can be backported (see <span class="target" id="index-7"></span><a class="pep reference external" href="https://peps.python.org/pep-0434/"><strong>PEP 434</strong></a>).</p>
847+
sense that feature changes can be backported (see <span class="target" id="index-9"></span><a class="pep reference external" href="https://peps.python.org/pep-0434/"><strong>PEP 434</strong></a>).</p>
802848
</section>
803849
</section>
804850

0 commit comments

Comments
 (0)