Skip to content

Commit 947adca

Browse files
authored
bpo-35764: Rewrite the IDLE Calltips doc section (GH-22363)
1 parent 0d0e9fe commit 947adca

File tree

4 files changed

+51
-42
lines changed

4 files changed

+51
-42
lines changed

Doc/library/idle.rst

+25-22
Original file line numberDiff line numberDiff line change
@@ -527,30 +527,33 @@ by typing '_' after '.', either before or after the box is opened.
527527
Calltips
528528
^^^^^^^^
529529

530-
A calltip is shown when one types :kbd:`(` after the name of an *accessible*
531-
function. A name expression may include dots and subscripts. A calltip
532-
remains until it is clicked, the cursor is moved out of the argument area,
533-
or :kbd:`)` is typed. When the cursor is in the argument part of a definition,
534-
the menu or shortcut display a calltip.
535-
536-
A calltip consists of the function signature and the first line of the
537-
docstring. For builtins without an accessible signature, the calltip
538-
consists of all lines up the fifth line or the first blank line. These
539-
details may change.
540-
541-
The set of *accessible* functions depends on what modules have been imported
542-
into the user process, including those imported by Idle itself,
543-
and what definitions have been run, all since the last restart.
530+
A calltip is shown automatically when one types :kbd:`(` after the name
531+
of an *accessible* function. A function name expression may include
532+
dots and subscripts. A calltip remains until it is clicked, the cursor
533+
is moved out of the argument area, or :kbd:`)` is typed. Whenever the
534+
cursor is in the argument part of a definition, select Edit and "Show
535+
Call Tip" on the menu or enter its shortcut to display a calltip.
536+
537+
The calltip consists of the function's signature and docstring up to
538+
the latter's first blank line or the fifth non-blank line. (Some builtin
539+
functions lack an accessible signature.) A '/' or '*' in the signature
540+
indicates that the preceding or following arguments are passed by
541+
position or name (keyword) only. Details are subject to change.
542+
543+
In Shell, the accessible functions depends on what modules have been
544+
imported into the user process, including those imported by Idle itself,
545+
and which definitions have been run, all since the last restart.
544546

545547
For example, restart the Shell and enter ``itertools.count(``. A calltip
546-
appears because Idle imports itertools into the user process for its own use.
547-
(This could change.) Enter ``turtle.write(`` and nothing appears. Idle does
548-
not import turtle. The menu or shortcut do nothing either. Enter
549-
``import turtle`` and then ``turtle.write(`` will work.
550-
551-
In an editor, import statements have no effect until one runs the file. One
552-
might want to run a file after writing the import statements at the top,
553-
or immediately run an existing file before editing.
548+
appears because Idle imports itertools into the user process for its own
549+
use. (This could change.) Enter ``turtle.write(`` and nothing appears.
550+
Idle does not itself import turtle. The menu entry and shortcut also do
551+
nothing. Enter ``import turtle``. Thereafter, ``turtle.write(``
552+
will display a calltip.
553+
554+
In an editor, import statements have no effect until one runs the file.
555+
One might want to run a file after writing import statements, after
556+
adding function definitions, or after opening an existing file.
554557

555558
.. _code-context:
556559

Lib/idlelib/NEWS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Released on 2020-10-05?
33
======================================
44

55

6+
bpo-35764: Rewrite the Calltips doc section.
7+
68
bpo-40181: In calltips, stop reminding that '/' marks the end of
79
positional-only arguments.
810

Lib/idlelib/help.html

+23-20
Original file line numberDiff line numberDiff line change
@@ -509,26 +509,29 @@ <h3>Automatic indentation<a class="headerlink" href="#automatic-indentation" tit
509509
</div>
510510
<div class="section" id="calltips">
511511
<span id="id4"></span><h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline"></a></h3>
512-
<p>A calltip is shown when one types <kbd class="kbd docutils literal notranslate">(</kbd> after the name of an <em>accessible</em>
513-
function. A name expression may include dots and subscripts. A calltip
514-
remains until it is clicked, the cursor is moved out of the argument area,
515-
or <kbd class="kbd docutils literal notranslate">)</kbd> is typed. When the cursor is in the argument part of a definition,
516-
the menu or shortcut display a calltip.</p>
517-
<p>A calltip consists of the function signature and the first line of the
518-
docstring. For builtins without an accessible signature, the calltip
519-
consists of all lines up the fifth line or the first blank line. These
520-
details may change.</p>
521-
<p>The set of <em>accessible</em> functions depends on what modules have been imported
522-
into the user process, including those imported by Idle itself,
523-
and what definitions have been run, all since the last restart.</p>
512+
<p>A calltip is shown automatically when one types <kbd class="kbd docutils literal notranslate">(</kbd> after the name
513+
of an <em>accessible</em> function. A function name expression may include
514+
dots and subscripts. A calltip remains until it is clicked, the cursor
515+
is moved out of the argument area, or <kbd class="kbd docutils literal notranslate">)</kbd> is typed. Whenever the
516+
cursor is in the argument part of a definition, select Edit and “Show
517+
Call Tip” on the menu or enter its shortcut to display a calltip.</p>
518+
<p>The calltip consists of the function’s signature and docstring up to
519+
the latter’s first blank line or the fifth non-blank line. (Some builtin
520+
functions lack an accessible signature.) A ‘/’ or ‘*’ in the signature
521+
indicates that the preceding or following arguments are passed by
522+
position or name (keyword) only. Details are subject to change.</p>
523+
<p>In Shell, the accessible functions depends on what modules have been
524+
imported into the user process, including those imported by Idle itself,
525+
and which definitions have been run, all since the last restart.</p>
524526
<p>For example, restart the Shell and enter <code class="docutils literal notranslate"><span class="pre">itertools.count(</span></code>. A calltip
525-
appears because Idle imports itertools into the user process for its own use.
526-
(This could change.) Enter <code class="docutils literal notranslate"><span class="pre">turtle.write(</span></code> and nothing appears. Idle does
527-
not import turtle. The menu or shortcut do nothing either. Enter
528-
<code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">turtle</span></code> and then <code class="docutils literal notranslate"><span class="pre">turtle.write(</span></code> will work.</p>
529-
<p>In an editor, import statements have no effect until one runs the file. One
530-
might want to run a file after writing the import statements at the top,
531-
or immediately run an existing file before editing.</p>
527+
appears because Idle imports itertools into the user process for its own
528+
use. (This could change.) Enter <code class="docutils literal notranslate"><span class="pre">turtle.write(</span></code> and nothing appears.
529+
Idle does not itself import turtle. The menu entry and shortcut also do
530+
nothing. Enter <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">turtle</span></code>. Thereafter, <code class="docutils literal notranslate"><span class="pre">turtle.write(</span></code>
531+
will display a calltip.</p>
532+
<p>In an editor, import statements have no effect until one runs the file.
533+
One might want to run a file after writing import statements, after
534+
adding function definitions, or after opening an existing file.</p>
532535
</div>
533536
<div class="section" id="code-context">
534537
<span id="id5"></span><h3>Code Context<a class="headerlink" href="#code-context" title="Permalink to this headline"></a></h3>
@@ -975,7 +978,7 @@ <h3>Navigation</h3>
975978
<br />
976979
<br />
977980

978-
Last updated on Sep 09, 2020.
981+
Last updated on Sep 22, 2020.
979982
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
980983
<br />
981984

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Rewrite the Calltips doc section.

0 commit comments

Comments
 (0)