Some cleanup in the docs.

This commit is contained in:
Georg Brandl 2007-12-29 10:57:00 +00:00
parent 28c7bcf38e
commit b19be571e0
126 changed files with 804 additions and 1181 deletions

View file

@ -70,6 +70,8 @@ on a separate line for clarity.
.. _if:
.. _elif:
.. _else:
The :keyword:`if` statement
===========================
@ -206,6 +208,8 @@ effect of Pascal's ``for i := a to b do``; e.g., ``range(3)`` returns the list
.. _try:
.. _except:
.. _finally:
The :keyword:`try` statement
============================
@ -320,6 +324,7 @@ may be found in section :ref:`raise`.
.. _with:
.. _as:
The :keyword:`with` statement
=============================
@ -386,6 +391,7 @@ The execution of the :keyword:`with` statement proceeds as follows:
.. _function:
.. _def:
Function definitions
====================

View file

@ -214,8 +214,6 @@ Numbers
without causing overflow, will yield the same result in the long integer domain
or when using mixed operands.
.. % Integers
Floating point numbers
.. index::
object: floating point
@ -241,8 +239,6 @@ Numbers
The real and imaginary parts of a complex number ``z`` can be retrieved through
the read-only attributes ``z.real`` and ``z.imag``.
.. % Numbers
Sequences
.. index::
builtin: len
@ -346,8 +342,6 @@ Sequences
by itself does not create a tuple, since parentheses must be usable for grouping
of expressions). An empty tuple can be formed by an empty pair of parentheses.
.. % Immutable sequences
Mutable sequences
.. index::
object: mutable sequence
@ -376,10 +370,6 @@ Sequences
The extension module :mod:`array` provides an additional example of a mutable
sequence type.
.. % Mutable sequences
.. % Sequences
Set types
.. index::
builtin: len
@ -414,8 +404,6 @@ Set types
:term:`hashable`, it can be used again as an element of another set, or as
a dictionary key.
.. % Set types
Mappings
.. index::
builtin: len
@ -453,8 +441,6 @@ Mappings
The extension modules :mod:`dbm`, :mod:`gdbm`, and :mod:`bsddb` provide
additional examples of mapping types.
.. % Mapping types
Callable types
.. index::
object: callable
@ -726,8 +712,6 @@ Modules
object used to initialize the module (since it isn't needed once the
initialization is done).
.. %
Attribute assignment updates the module's namespace dictionary, e.g., ``m.x =
1`` is equivalent to ``m.__dict__["x"] = 1``.
@ -1078,10 +1062,6 @@ Internal types
described above, under "User-defined methods". Class method objects are created
by the built-in :func:`classmethod` constructor.
.. % Internal types
.. % Types
.. % =========================================================================
.. _newstyle:
@ -1128,8 +1108,6 @@ The plan is to eventually drop old-style classes, leaving only the semantics of
new-style classes. This change will probably only be feasible in Python 3.0.
new-style classic old-style
.. % =========================================================================
.. _specialnames:

View file

@ -105,8 +105,6 @@ transformed name is extremely long (longer than 255 characters), implementation
defined truncation may happen. If the class name consists only of underscores,
no transformation is done.
.. %
.. %
.. _atom-literals:
@ -979,6 +977,10 @@ must be plain or long integers. The arguments are converted to a common type.
.. _comparisons:
.. _is:
.. _isnot:
.. _in:
.. _notin:
Comparisons
===========
@ -1108,6 +1110,9 @@ yields the inverse truth value.
.. _booleans:
.. _and:
.. _or:
.. _not:
Boolean operations
==================

View file

@ -131,7 +131,7 @@ converted to Unicode for syntactical analysis, then converted back to their
original encoding before interpretation starts. The encoding declaration must
appear on a line of its own.
.. % XXX there should be a list of supported encodings.
.. XXX there should be a list of supported encodings.
.. _explicit-joining:
@ -149,11 +149,7 @@ Two or more physical lines may be joined into logical lines using backslash
characters (``\``), as follows: when a physical line ends in a backslash that is
not part of a string literal or comment, it is joined with the following forming
a single logical line, deleting the backslash and the following end-of-line
character. For example:
.. %
::
character. For example::
if 1900 < year < 2100 and 1 <= month <= 12 \
and 1 <= day <= 31 and 0 <= hour < 24 \

View file

@ -142,8 +142,6 @@ Assignment of an object to a single target is recursively defined as follows.
for the object previously bound to the name to reach zero, causing the object to
be deallocated and its destructor (if it has one) to be called.
.. % nested
* If the target is a target list enclosed in parentheses or in square brackets:
The object must be a sequence with the same number of items as there are targets
in the target list, and its items are assigned, from left to right, to the
@ -295,16 +293,16 @@ The extended form, ``assert expression1, expression2``, is equivalent to ::
single: __debug__
exception: AssertionError
These equivalences assume that ``__debug__`` and :exc:`AssertionError` refer to
These equivalences assume that :const:`__debug__` and :exc:`AssertionError` refer to
the built-in variables with those names. In the current implementation, the
built-in variable ``__debug__`` is ``True`` under normal circumstances,
built-in variable :const:`__debug__` is ``True`` under normal circumstances,
``False`` when optimization is requested (command line option -O). The current
code generator emits no code for an assert statement when optimization is
requested at compile time. Note that it is unnecessary to include the source
code for the expression that failed in the error message; it will be displayed
as part of the stack trace.
Assignments to ``__debug__`` are illegal. The value for the built-in variable
Assignments to :const:`__debug__` are illegal. The value for the built-in variable
is determined when the interpreter starts.
@ -634,6 +632,7 @@ cycle of the nearest enclosing loop.
.. _import:
.. _from:
The :keyword:`import` statement
===============================
@ -755,8 +754,6 @@ bothered to spell this out right now; see the URL
http://www.python.org/doc/essays/packages.html for more details, also about how
the module search works from inside a package.]
.. %
.. index:: builtin: __import__
The built-in function :func:`__import__` is provided to support applications