Provide links to Python source where the code is short, readable and · pythoncapi/cpython@6e6cb8e · GitHub
Skip to content

Commit 6e6cb8e

Browse files
committed
Provide links to Python source where the code is short, readable and
informative adjunct to the docs. Forward-port of Raymond's r86225 and r86245 using the new source reST role added in python#10334.
1 parent dbe7519 commit 6e6cb8e

29 files changed

Lines changed: 134 additions & 0 deletions

Doc/library/ast.rst

Lines changed: 3 additions & 0 deletions

Doc/library/atexit.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ The :mod:`atexit` module defines functions to register and unregister cleanup
1111
functions. Functions thus registered are automatically executed upon normal
1212
interpreter termination.
1313

14+
.. seealso::
15+
16+
Latest version of the :source:`atexit Python source code
17+
<Lib/atexit.py>`
18+
1419
Note: the functions registered via this module are not called when the program
1520
is killed by a signal not handled by Python, when a Python fatal internal error
1621
is detected, or when :func:`os._exit` is called.

Doc/library/bisect.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ approach. The module is called :mod:`bisect` because it uses a basic bisection
1414
algorithm to do its work. The source code may be most useful as a working
1515
example of the algorithm (the boundary conditions are already right!).
1616

17+
.. seealso::
18+
19+
Latest version of the :source:`bisect module Python source code
20+
<Lib/bisect.py>`
21+
1722
The following functions are provided:
1823

1924

Doc/library/calendar.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ in both directions. This matches the definition of the "proleptic Gregorian"
2121
calendar in Dershowitz and Reingold's book "Calendrical Calculations", where
2222
it's the base calendar for all computations.
2323

24+
.. seealso::
25+
26+
Latest version of the :source:`calendar module Python source code
27+
<Lib/calendar.py>`
2428

2529
.. class:: Calendar(firstweekday=0)
2630

Doc/library/cmd.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ command interpreters. These are often useful for test harnesses, administrative
1111
tools, and prototypes that will later be wrapped in a more sophisticated
1212
interface.
1313

14+
.. seealso::
15+
16+
Latest version of the :source:`cmd module Python source code <Lib/cmd.py>`
1417

1518
.. class:: Cmd(completekey='tab', stdin=None, stdout=None)
1619

Doc/library/collections.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ In addition to the concrete container classes, the collections module provides
3131
ABCs (abstract base classes) that can be used to test whether a class provides a
3232
particular interface, for example, whether it is hashable or a mapping.
3333

34+
.. seealso::
35+
36+
Latest version of the :source:`collections module Python source code
37+
<Lib/collections.py>`
38+
3439

3540
:class:`Counter` objects
3641
------------------------
@@ -1059,6 +1064,9 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin:
10591064

10601065
.. seealso::
10611066

1067+
* Latest version of the :source:`Python source code for the collections
1068+
abstract base classes <Lib/_abcoll.py>`
1069+
10621070
* `OrderedSet recipe <http://code.activestate.com/recipes/576694/>`_ for an
10631071
example built on :class:`MutableSet`.
10641072

Doc/library/contextlib.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ This module provides utilities for common tasks involving the :keyword:`with`
99
statement. For more information see also :ref:`typecontextmanager` and
1010
:ref:`context-managers`.
1111

12+
.. seealso::
13+
14+
Latest version of the :source:`contextlib Python source code
15+
<Lib/contextlib.py>`
16+
1217
Functions provided:
1318

1419

Doc/library/dis.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ disassembling it. The CPython bytecode which this module takes as an
1010
input is defined in the file :file:`Include/opcode.h` and used by the compiler
1111
and the interpreter.
1212

13+
.. seealso::
14+
15+
Latest version of the :source:`dis module Python source code <Lib/dis.py>`
16+
1317
.. impl-detail::
1418

1519
Bytecode is an implementation detail of the CPython interpreter! No

Doc/library/filecmp.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ The :mod:`filecmp` module defines functions to compare files and directories,
1010
with various optional time/correctness trade-offs. For comparing files,
1111
see also the :mod:`difflib` module.
1212

13+
.. seealso::
14+
15+
Latest version of the :source:`filecmp Python source code
16+
<Lib/filecmp.py>`
17+
1318
The :mod:`filecmp` module defines the following functions:
1419

1520

Doc/library/fileinput.rst

Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)