summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-09-01 22:03:20 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-09-01 22:03:20 (GMT)
commit793c47a88a8ad3b1e113308fa9cd359fb3819879 (patch)
tree7dfa0fc9d0fa294b1399cba8c6bea56f142aeb36 /Doc
parentae5af15e418f49bd9ea76b781090c669981bc57d (diff)
parent024de54fc234e4ad67d6f9abaef4d70d3cce0785 (diff)
downloadcpython-793c47a88a8ad3b1e113308fa9cd359fb3819879.zip
cpython-793c47a88a8ad3b1e113308fa9cd359fb3819879.tar.gz
cpython-793c47a88a8ad3b1e113308fa9cd359fb3819879.tar.bz2
Merge doc changes from 3.2 (#10454, #12298)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/documenting/markup.rst5
-rw-r--r--Doc/library/functions.rst36
-rw-r--r--Doc/library/stdtypes.rst4
-rw-r--r--Doc/library/string.rst2
4 files changed, 37 insertions, 10 deletions
diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst
index c005d0c..ce39d3b 100644
--- a/Doc/documenting/markup.rst
+++ b/Doc/documenting/markup.rst
@@ -513,7 +513,10 @@ in a different style:
.. 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
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 3b6fdc3..4ed3ec5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -10,7 +10,7 @@ are always available. They are listed here in alphabetical order.
=================== ================= ================== ================ ====================
.. .. 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:`any` :func:`divmod` :func:`id` :func:`object` :func:`sorted`
: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:`bytes` :func:`float` :func:`iter` :func:`print` :func:`tuple`
: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:`compile` :func:`globals` :func:`map` :func:`reversed` :func:`__import__`
: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)
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])
- Convert a value to a Boolean, using the standard truth testing procedure. If
- *x* is false or omitted, this returns :const:`False`; otherwise it returns
- :const:`True`. :class:`bool` is also a class, which is a subclass of
- :class:`int`. Class :class:`bool` cannot be subclassed further. Its only
- instances are :const:`False` and :const:`True`.
+ Convert a value to a Boolean, using the standard :ref:`truth testing
+ procedure <truth>`. If *x* is false or omitted, this returns ``False``;
+ otherwise it returns ``True``. :class:`bool` is also a class, which is a
+ subclass of :class:`int` (see :ref:`typesnumeric`). Class :class:`bool`
+ cannot be subclassed further. Its only instances are ``False`` and
+ ``True`` (see :ref:`bltin-boolean-values`).
.. 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``.
+.. _func-dict:
.. function:: dict([arg])
:noindex:
@@ -491,6 +502,7 @@ are always available. They are listed here in alphabetical order.
The float type is described in :ref:`typesnumeric`.
+
.. function:: format(value[, format_spec])
.. 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
the *format_spec* or the return value are not strings.
+
+.. _func-frozenset:
.. function:: frozenset([iterable])
: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
``heapq.nlargest(1, iterable, key=keyfunc)``.
+
+.. _func-memoryview:
.. function:: memoryview(obj)
: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
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
@@ -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
more information.
+
+.. _func-set:
.. function:: set([iterable])
:noindex:
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index a5f0d59..46f0f9f 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2724,6 +2724,8 @@ special operations. There is exactly one ellipsis object, named
It is written as ``Ellipsis`` or ``...``.
+.. _bltin-notimplemented-object:
+
The NotImplemented Object
-------------------------
@@ -2735,6 +2737,8 @@ information. There is exactly one ``NotImplemented`` object.
It is written as ``NotImplemented``.
+.. _bltin-boolean-values:
+
Boolean Values
--------------
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 2443180..78f2b4d 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -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
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.
+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
attribute expressions. An expression of the form ``'.name'`` selects the named
attribute using :func:`getattr`, while an expression of the form ``'[index]'``