mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
commit
793c47a88a
7 changed files with 47 additions and 23 deletions
|
|
@ -513,7 +513,10 @@ in a different style:
|
||||||
|
|
||||||
.. describe:: keyword
|
.. describe:: keyword
|
||||||
|
|
||||||
The name of a keyword in Python.
|
The name of a Python keyword. Using this role will generate a link to the
|
||||||
|
documentation of the keyword. ``True``, ``False`` and ``None`` do not use
|
||||||
|
this role, but simple code markup (````True````), given that they're
|
||||||
|
fundamental to the language and should be known to any programmer.
|
||||||
|
|
||||||
.. describe:: mailheader
|
.. describe:: mailheader
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
=================== ================= ================== ================ ====================
|
=================== ================= ================== ================ ====================
|
||||||
.. .. Built-in Functions .. ..
|
.. .. Built-in Functions .. ..
|
||||||
=================== ================= ================== ================ ====================
|
=================== ================= ================== ================ ====================
|
||||||
:func:`abs` :func:`dict` :func:`help` :func:`min` :func:`setattr`
|
:func:`abs` |func-dict|_ :func:`help` :func:`min` :func:`setattr`
|
||||||
:func:`all` :func:`dir` :func:`hex` :func:`next` :func:`slice`
|
:func:`all` :func:`dir` :func:`hex` :func:`next` :func:`slice`
|
||||||
:func:`any` :func:`divmod` :func:`id` :func:`object` :func:`sorted`
|
:func:`any` :func:`divmod` :func:`id` :func:`object` :func:`sorted`
|
||||||
:func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod`
|
:func:`ascii` :func:`enumerate` :func:`input` :func:`oct` :func:`staticmethod`
|
||||||
|
|
@ -19,13 +19,22 @@ are always available. They are listed here in alphabetical order.
|
||||||
:func:`bytearray` :func:`filter` :func:`issubclass` :func:`pow` :func:`super`
|
:func:`bytearray` :func:`filter` :func:`issubclass` :func:`pow` :func:`super`
|
||||||
:func:`bytes` :func:`float` :func:`iter` :func:`print` :func:`tuple`
|
:func:`bytes` :func:`float` :func:`iter` :func:`print` :func:`tuple`
|
||||||
:func:`callable` :func:`format` :func:`len` :func:`property` :func:`type`
|
:func:`callable` :func:`format` :func:`len` :func:`property` :func:`type`
|
||||||
:func:`chr` :func:`frozenset` :func:`list` :func:`range` :func:`vars`
|
:func:`chr` |func-frozenset|_ :func:`list` :func:`range` :func:`vars`
|
||||||
:func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip`
|
:func:`classmethod` :func:`getattr` :func:`locals` :func:`repr` :func:`zip`
|
||||||
:func:`compile` :func:`globals` :func:`map` :func:`reversed` :func:`__import__`
|
:func:`compile` :func:`globals` :func:`map` :func:`reversed` :func:`__import__`
|
||||||
:func:`complex` :func:`hasattr` :func:`max` :func:`round`
|
:func:`complex` :func:`hasattr` :func:`max` :func:`round`
|
||||||
:func:`delattr` :func:`hash` :func:`memoryview` :func:`set`
|
:func:`delattr` :func:`hash` |func-memoryview|_ |func-set|_
|
||||||
=================== ================= ================== ================ ====================
|
=================== ================= ================== ================ ====================
|
||||||
|
|
||||||
|
.. using :func:`dict` would create a link to another page, so local targets are
|
||||||
|
used, with replacement texts to make the output in the table consistent
|
||||||
|
|
||||||
|
.. |func-dict| replace:: ``dict()``
|
||||||
|
.. |func-frozenset| replace:: ``frozenset()``
|
||||||
|
.. |func-memoryview| replace:: ``memoryview()``
|
||||||
|
.. |func-set| replace:: ``set()``
|
||||||
|
|
||||||
|
|
||||||
.. function:: abs(x)
|
.. function:: abs(x)
|
||||||
|
|
||||||
Return the absolute value of a number. The argument may be an
|
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.
|
||||||
|
|
||||||
.. function:: bool([x])
|
.. function:: bool([x])
|
||||||
|
|
||||||
Convert a value to a Boolean, using the standard truth testing procedure. If
|
Convert a value to a Boolean, using the standard :ref:`truth testing
|
||||||
*x* is false or omitted, this returns :const:`False`; otherwise it returns
|
procedure <truth>`. If *x* is false or omitted, this returns ``False``;
|
||||||
:const:`True`. :class:`bool` is also a class, which is a subclass of
|
otherwise it returns ``True``. :class:`bool` is also a class, which is a
|
||||||
:class:`int`. Class :class:`bool` cannot be subclassed further. Its only
|
subclass of :class:`int` (see :ref:`typesnumeric`). Class :class:`bool`
|
||||||
instances are :const:`False` and :const:`True`.
|
cannot be subclassed further. Its only instances are ``False`` and
|
||||||
|
``True`` (see :ref:`bltin-boolean-values`).
|
||||||
|
|
||||||
.. index:: pair: Boolean; type
|
.. index:: pair: Boolean; type
|
||||||
|
|
||||||
|
|
@ -248,6 +258,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``.
|
example, ``delattr(x, 'foobar')`` is equivalent to ``del x.foobar``.
|
||||||
|
|
||||||
|
|
||||||
|
.. _func-dict:
|
||||||
.. function:: dict([arg])
|
.. function:: dict([arg])
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
|
@ -491,6 +502,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
The float type is described in :ref:`typesnumeric`.
|
The float type is described in :ref:`typesnumeric`.
|
||||||
|
|
||||||
|
|
||||||
.. function:: format(value[, format_spec])
|
.. function:: format(value[, format_spec])
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
|
|
@ -511,6 +523,8 @@ are always available. They are listed here in alphabetical order.
|
||||||
:exc:`TypeError` exception is raised if the method is not found or if either
|
:exc:`TypeError` exception is raised if the method is not found or if either
|
||||||
the *format_spec* or the return value are not strings.
|
the *format_spec* or the return value are not strings.
|
||||||
|
|
||||||
|
|
||||||
|
.. _func-frozenset:
|
||||||
.. function:: frozenset([iterable])
|
.. function:: frozenset([iterable])
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
|
@ -717,6 +731,8 @@ are always available. They are listed here in alphabetical order.
|
||||||
such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and
|
such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and
|
||||||
``heapq.nlargest(1, iterable, key=keyfunc)``.
|
``heapq.nlargest(1, iterable, key=keyfunc)``.
|
||||||
|
|
||||||
|
|
||||||
|
.. _func-memoryview:
|
||||||
.. function:: memoryview(obj)
|
.. function:: memoryview(obj)
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
|
@ -1040,7 +1056,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
Range objects implement the :class:`collections.Sequence` ABC, and provide
|
Range objects implement the :class:`collections.Sequence` ABC, and provide
|
||||||
features such as containment tests, element index lookup, slicing and
|
features such as containment tests, element index lookup, slicing and
|
||||||
support for negative indices:
|
support for negative indices (see :ref:`typesseq`):
|
||||||
|
|
||||||
>>> r = range(0, 20, 2)
|
>>> r = range(0, 20, 2)
|
||||||
>>> r
|
>>> r
|
||||||
|
|
@ -1108,6 +1124,8 @@ are always available. They are listed here in alphabetical order.
|
||||||
can't be represented exactly as a float. See :ref:`tut-fp-issues` for
|
can't be represented exactly as a float. See :ref:`tut-fp-issues` for
|
||||||
more information.
|
more information.
|
||||||
|
|
||||||
|
|
||||||
|
.. _func-set:
|
||||||
.. function:: set([iterable])
|
.. function:: set([iterable])
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2724,6 +2724,8 @@ special operations. There is exactly one ellipsis object, named
|
||||||
It is written as ``Ellipsis`` or ``...``.
|
It is written as ``Ellipsis`` or ``...``.
|
||||||
|
|
||||||
|
|
||||||
|
.. _bltin-notimplemented-object:
|
||||||
|
|
||||||
The NotImplemented Object
|
The NotImplemented Object
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
@ -2735,6 +2737,8 @@ information. There is exactly one ``NotImplemented`` object.
|
||||||
It is written as ``NotImplemented``.
|
It is written as ``NotImplemented``.
|
||||||
|
|
||||||
|
|
||||||
|
.. _bltin-boolean-values:
|
||||||
|
|
||||||
Boolean Values
|
Boolean Values
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke
|
||||||
it refers to a named keyword argument. If the numerical arg_names in a format string
|
it refers to a named keyword argument. If the numerical arg_names in a format string
|
||||||
are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
|
are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
|
||||||
and the numbers 0, 1, 2, ... will be automatically inserted in that order.
|
and the numbers 0, 1, 2, ... will be automatically inserted in that order.
|
||||||
|
Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary
|
||||||
|
dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string.
|
||||||
The *arg_name* can be followed by any number of index or
|
The *arg_name* can be followed by any number of index or
|
||||||
attribute expressions. An expression of the form ``'.name'`` selects the named
|
attribute expressions. An expression of the form ``'.name'`` selects the named
|
||||||
attribute using :func:`getattr`, while an expression of the form ``'[index]'``
|
attribute using :func:`getattr`, while an expression of the form ``'[index]'``
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False,
|
||||||
|
|
||||||
Arguments (all optional):
|
Arguments (all optional):
|
||||||
|
|
||||||
skip_curdir: if true, skip current directory (default true)
|
skip_curdir: if true, skip current directory (default True)
|
||||||
maxlevels: max recursion level (default 0)
|
maxlevels: max recursion level (default 0)
|
||||||
force: as for compile_dir() (default False)
|
force: as for compile_dir() (default False)
|
||||||
quiet: as for compile_dir() (default False)
|
quiet: as for compile_dir() (default False)
|
||||||
|
|
@ -177,17 +177,17 @@ def main():
|
||||||
help='use legacy (pre-PEP3147) compiled file locations')
|
help='use legacy (pre-PEP3147) compiled file locations')
|
||||||
parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None,
|
parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None,
|
||||||
help=('directory to prepend to file paths for use in '
|
help=('directory to prepend to file paths for use in '
|
||||||
'compile time tracebacks and in runtime '
|
'compile-time tracebacks and in runtime '
|
||||||
'tracebacks in cases where the source file is '
|
'tracebacks in cases where the source file is '
|
||||||
'unavailable'))
|
'unavailable'))
|
||||||
parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None,
|
parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None,
|
||||||
help=('skip files matching the regular expression. '
|
help=('skip files matching the regular expression; '
|
||||||
'The regexp is searched for in the full path '
|
'the regexp is searched for in the full path '
|
||||||
'to each file considered for compilation.'))
|
'of each file considered for compilation'))
|
||||||
parser.add_argument('-i', metavar='FILE', dest='flist',
|
parser.add_argument('-i', metavar='FILE', dest='flist',
|
||||||
help=('add all the files and directories listed in '
|
help=('add all the files and directories listed in '
|
||||||
'FILE to the list considered for compilation. '
|
'FILE to the list considered for compilation; '
|
||||||
'If "-", names are read from stdin.'))
|
'if "-", names are read from stdin'))
|
||||||
parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*',
|
parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*',
|
||||||
help=('zero or more file and directory names '
|
help=('zero or more file and directory names '
|
||||||
'to compile; if no arguments given, defaults '
|
'to compile; if no arguments given, defaults '
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,9 @@ def _get_xxmodule_path():
|
||||||
def fixup_build_ext(cmd):
|
def fixup_build_ext(cmd):
|
||||||
"""Function needed to make build_ext tests pass.
|
"""Function needed to make build_ext tests pass.
|
||||||
|
|
||||||
When Python was build with --enable-shared on Unix, -L. is not good
|
When Python was built with --enable-shared on Unix, -L. is not enough to
|
||||||
enough to find the libpython<blah>.so. This is because regrtest runs
|
find libpython<blah>.so, because regrtest runs in a tempdir, not in the
|
||||||
it under a tempdir, not in the top level where the .so lives. By the
|
source directory where the .so lives.
|
||||||
time we've gotten here, Python's already been chdir'd to the tempdir.
|
|
||||||
|
|
||||||
When Python was built with in debug mode on Windows, build_ext commands
|
When Python was built with in debug mode on Windows, build_ext commands
|
||||||
need their debug attribute set, and it is not done automatically for
|
need their debug attribute set, and it is not done automatically for
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ for the built-in function open() or for os.popen().
|
||||||
|
|
||||||
To create a new template object initialized to a given one:
|
To create a new template object initialized to a given one:
|
||||||
t2 = t.clone()
|
t2 = t.clone()
|
||||||
|
|
||||||
For an example, see the function test() at the end of the file.
|
|
||||||
""" # '
|
""" # '
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue