Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 793c47a

Browse files
committed
Merge doc changes from 3.2 (#10454, #12298)
2 parents ae5af15 + 024de54 commit 793c47a

7 files changed

Lines changed: 47 additions & 23 deletions

File tree

Doc/documenting/markup.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,10 @@ in a different style:
513513

514514
.. describe:: keyword
515515

516-
The name of a keyword in Python.
516+
The name of a Python keyword. Using this role will generate a link to the
517+
documentation of the keyword. ``True``, ``False`` and ``None`` do not use
518+
this role, but simple code markup (````True````), given that they're
519+
fundamental to the language and should be known to any programmer.
517520

518521
.. describe:: mailheader
519522

Doc/library/functions.rst

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ are always available. They are listed here in alphabetical order.
1010
=================== ================= ================== ================ ====================
1111
.. .. Built-in Functions .. ..
1212
=================== ================= ================== ================ ====================
13-
:func:`abs` :func:`dict` :func:`help` :func:`min` :func:`setattr`
13+
:func:`abs` |func-dict|_ :func:`help` :func:`min` :func:`setattr`
1414
:func:`all` :func:`dir` :func:`hex` :func:`next` :func:`slice`
1515
:func:`any` :func:`divmod` :func:`id` :func:`object` :func:`sorted`
1616
:func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod`
@@ -19,13 +19,22 @@ are always available. They are listed here in alphabetical order.
1919
:func:`bytearray` :func:`filter` :func:`issubclass` :func:`pow` :func:`super`
2020
:func:`bytes` :func:`float` :func:`iter` :func:`print` :func:`tuple`
2121
:func:`callable` :func:`format` :func:`len` :func:`property` :func:`type`
22-
:func:`chr` :func:`frozenset` :func:`list` :func:`range` :func:`vars`
22+
:func:`chr` |func-frozenset|_ :func:`list` :func:`range` :func:`vars`
2323
:func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip`
2424
:func:`compile` :func:`globals` :func:`map` :func:`reversed` :func:`__import__`
2525
:func:`complex` :func:`hasattr` :func:`max` :func:`round`
26-
:func:`delattr` :func:`hash` :func:`memoryview` :func:`set`
26+
:func:`delattr` :func:`hash` |func-memoryview|_ |func-set|_
2727
=================== ================= ================== ================ ====================
2828

29+
.. using :func:`dict` would create a link to another page, so local targets are
30+
used, with replacement texts to make the output in the table consistent
31+
32+
.. |func-dict| replace:: ``dict()``
33+
.. |func-frozenset| replace:: ``frozenset()``
34+
.. |func-memoryview| replace:: ``memoryview()``
35+
.. |func-set| replace:: ``set()``
36+
37+
2938
.. function:: abs(x)
3039

3140
Return the absolute value of a number. The argument may be an
@@ -74,11 +83,12 @@ are always available. They are listed here in alphabetical order.
7483

7584
.. function:: bool([x])
7685

77-
Convert a value to a Boolean, using the standard truth testing procedure. If
78-
*x* is false or omitted, this returns :const:`False`; otherwise it returns
79-
:const:`True`. :class:`bool` is also a class, which is a subclass of
80-
:class:`int`. Class :class:`bool` cannot be subclassed further. Its only
81-
instances are :const:`False` and :const:`True`.
86+
Convert a value to a Boolean, using the standard :ref:`truth testing
87+
procedure <truth>`. If *x* is false or omitted, this returns ``False``;
88+
otherwise it returns ``True``. :class:`bool` is also a class, which is a
89+
subclass of :class:`int` (see :ref:`typesnumeric`). Class :class:`bool`
90+
cannot be subclassed further. Its only instances are ``False`` and
91+
``True`` (see :ref:`bltin-boolean-values`).
8292

8393
.. index:: pair: Boolean; type
8494

@@ -248,6 +258,7 @@ are always available. They are listed here in alphabetical order.
248258
example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``.
249259

250260

261+
.. _func-dict:
251262
.. function:: dict([arg])
252263
:noindex:
253264

@@ -491,6 +502,7 @@ are always available. They are listed here in alphabetical order.
491502

492503
The float type is described in :ref:`typesnumeric`.
493504

505+
494506
.. function:: format(value[, format_spec])
495507

496508
.. index::
@@ -511,6 +523,8 @@ are always available. They are listed here in alphabetical order.
511523
:exc:`TypeError` exception is raised if the method is not found or if either
512524
the *format_spec* or the return value are not strings.
513525

526+
527+
.. _func-frozenset:
514528
.. function:: frozenset([iterable])
515529
:noindex:
516530

@@ -717,6 +731,8 @@ are always available. They are listed here in alphabetical order.
717731
such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and
718732
``heapq.nlargest(1, iterable, key=keyfunc)``.
719733

734+
735+
.. _func-memoryview:
720736
.. function:: memoryview(obj)
721737
:noindex:
722738

@@ -1040,7 +1056,7 @@ are always available. They are listed here in alphabetical order.
10401056

10411057
Range objects implement the :class:`collections.Sequence` ABC, and provide
10421058
features such as containment tests, element index lookup, slicing and
1043-
support for negative indices:
1059+
support for negative indices (see :ref:`typesseq`):
10441060

10451061
>>> r = range(0, 20, 2)
10461062
>>> r
@@ -1108,6 +1124,8 @@ are always available. They are listed here in alphabetical order.
11081124
can't be represented exactly as a float. See :ref:`tut-fp-issues` for
11091125
more information.
11101126

1127+
1128+
.. _func-set:
11111129
.. function:: set([iterable])
11121130
:noindex:
11131131

Doc/library/stdtypes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,6 +2724,8 @@ special operations. There is exactly one ellipsis object, named
27242724
It is written as ``Ellipsis`` or ``...``.
27252725

27262726

2727+
.. _bltin-notimplemented-object:
2728+
27272729
The NotImplemented Object
27282730
-------------------------
27292731

@@ -2735,6 +2737,8 @@ information. There is exactly one ``NotImplemented`` object.
27352737
It is written as ``NotImplemented``.
27362738

27372739

2740+
.. _bltin-boolean-values:
2741+
27382742
Boolean Values
27392743
--------------
27402744

Doc/library/string.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke
216216
it refers to a named keyword argument. If the numerical arg_names in a format string
217217
are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
218218
and the numbers 0, 1, 2, ... will be automatically inserted in that order.
219+
Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary
220+
dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string.
219221
The *arg_name* can be followed by any number of index or
220222
attribute expressions. An expression of the form ``'.name'`` selects the named
221223
attribute using :func:`getattr`, while an expression of the form ``'[index]'``

Lib/compileall.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False,
142142
143143
Arguments (all optional):
144144
145-
skip_curdir: if true, skip current directory (default true)
145+
skip_curdir: if true, skip current directory (default True)
146146
maxlevels: max recursion level (default 0)
147147
force: as for compile_dir() (default False)
148148
quiet: as for compile_dir() (default False)
@@ -177,17 +177,17 @@ def main():
177177
help='use legacy (pre-PEP3147) compiled file locations')
178178
parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None,
179179
help=('directory to prepend to file paths for use in '
180-
'compile time tracebacks and in runtime '
180+
'compile-time tracebacks and in runtime '
181181
'tracebacks in cases where the source file is '
182182
'unavailable'))
183183
parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None,
184-
help=('skip files matching the regular expression. '
185-
'The regexp is searched for in the full path '
186-
'to each file considered for compilation.'))
184+
help=('skip files matching the regular expression; '
185+
'the regexp is searched for in the full path '
186+
'of each file considered for compilation'))
187187
parser.add_argument('-i', metavar='FILE', dest='flist',
188188
help=('add all the files and directories listed in '
189-
'FILE to the list considered for compilation. '
190-
'If "-", names are read from stdin.'))
189+
'FILE to the list considered for compilation; '
190+
'if "-", names are read from stdin'))
191191
parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*',
192192
help=('zero or more file and directory names '
193193
'to compile; if no arguments given, defaults '

Lib/distutils/tests/support.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ def _get_xxmodule_path():
175175
def fixup_build_ext(cmd):
176176
"""Function needed to make build_ext tests pass.
177177
178-
When Python was build with --enable-shared on Unix, -L. is not good
179-
enough to find the libpython<blah>.so. This is because regrtest runs
180-
it under a tempdir, not in the top level where the .so lives. By the
181-
time we've gotten here, Python's already been chdir'd to the tempdir.
178+
When Python was built with --enable-shared on Unix, -L. is not enough to
179+
find libpython<blah>.so, because regrtest runs in a tempdir, not in the
180+
source directory where the .so lives.
182181
183182
When Python was built with in debug mode on Windows, build_ext commands
184183
need their debug attribute set, and it is not done automatically for

Lib/pipes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
5555
To create a new template object initialized to a given one:
5656
t2 = t.clone()
57-
58-
For an example, see the function test() at the end of the file.
5957
""" # '
6058

6159

0 commit comments

Comments
 (0)