Fix all instances of bad reST generated by the converter.

Remove a debugging print.
This commit is contained in:
Georg Brandl 2007-08-02 13:06:23 +00:00
parent a3e2e48326
commit 28e7172f36
35 changed files with 258 additions and 278 deletions

View File

@ -2,7 +2,6 @@ To do after conversion
======================
* fix all references and links marked with `XXX`
* adjust all literal include paths
* fix all duplicate labels and undefined label references
* split very large files and add toctrees
* integrate standalone HOWTOs

View File

@ -1,9 +1,9 @@
.. _reporting-bugs:
**************
Reporting Bugs
**************
.. _reporting-bugs:
Python is a mature programming language which has established a reputation for
stability. In order to maintain this reputation, the developers would like to
know of any deficiencies you find in Python or its documentation.

View File

@ -3040,15 +3040,15 @@ objects.
.. cfunction:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
Create a :ctype:`PyCObject` from the ``void *``*cobj*. The *destr* function
Create a :ctype:`PyCObject` from the ``void *`` *cobj*. The *destr* function
will be called when the object is reclaimed, unless it is *NULL*.
.. cfunction:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
Create a :ctype:`PyCObject` from the :ctype:`void \*`*cobj*. The *destr*
function will be called when the object is reclaimed. The *desc* argument can be
used to pass extra callback data for the destructor function.
Create a :ctype:`PyCObject` from the :ctype:`void \*` *cobj*. The *destr*
function will be called when the object is reclaimed. The *desc* argument can
be used to pass extra callback data for the destructor function.
.. cfunction:: void* PyCObject_AsVoidPtr(PyObject* self)

View File

@ -204,7 +204,7 @@ Initialization, Finalization, and Threads
.. cfunction:: char* Py_GetExecPrefix()
Return the *exec-prefix* for installed platform-*de*pendent files. This is
Return the *exec-prefix* for installed platform-*dependent* files. This is
derived through a number of complicated rules from the program name set with
:cfunc:`Py_SetProgramName` and some environment variables; for example, if the
program name is ``'/usr/local/bin/python'``, the exec-prefix is

View File

@ -619,9 +619,9 @@ variable(s) whose address should be passed.
Convert a Python object to a C variable through a *converter* function. This
takes two arguments: the first is a function, the second is the address of a C
variable (of arbitrary type), converted to :ctype:`void \*`. The *converter*
function in turn is called as follows:
function in turn is called as follows::
*status*``=``*converter*``(``*object*, *address*``);``
status = converter(object, address);
where *object* is the Python object to be converted and *address* is the
:ctype:`void\*` argument that was passed to the :cfunc:`PyArg_Parse\*` function.

View File

@ -68,15 +68,15 @@ described here are distributed with the Python sources in the
#. **Build the example DLL** --- In order to check that everything is set up
right, try building:
#. Select a configuration. This step is optional. Choose :menuselection:`Build
--> Configuration Manager --> Active Solution Configuration` and select either
:guilabel:`Release` or\ :guilabel:`Debug`. If you skip this step, VC++ will
use the Debug configuration by default.
#. Select a configuration. This step is optional. Choose
:menuselection:`Build --> Configuration Manager --> Active Solution Configuration`
and select either :guilabel:`Release` or :guilabel:`Debug`. If you skip this
step, VC++ will use the Debug configuration by default.
#. Build the DLL. Choose :menuselection:`Build --> Build Solution`. This
creates all intermediate and result files in a subdirectory called either
:file:`Debug` or :file:`Release`, depending on which configuration you selected
in the preceding step.
creates all intermediate and result files in a subdirectory called either
:file:`Debug` or :file:`Release`, depending on which configuration you selected
in the preceding step.
#. **Testing the debug-mode DLL** --- Once the Debug build has succeeded, bring
up a DOS box, and change to the :file:`example_nt\\Debug` directory. You should

View File

@ -1103,7 +1103,7 @@ the following methods:
Pretend *count* lines have been changed, starting with line *start*. If
*changed* is supplied, it specifies whether the affected lines are marked as
having been changed (*changed*=1) or unchanged (*changed*=0).
having been changed (*changed*\ =1) or unchanged (*changed*\ =0).
.. method:: window.touchwin()

View File

@ -1160,20 +1160,20 @@ to work with the :class:`Decimal` class::
Decimal FAQ
-----------
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
minimize typing when using the interactive interpreter?
A. Some users abbreviate the constructor to just a single letter::
\A. Some users abbreviate the constructor to just a single letter::
>>> D = decimal.Decimal
>>> D('1.23') + D('3.45')
Decimal("4.68")
Q. In a fixed-point application with two decimal places, some inputs have many
Q. In a fixed-point application with two decimal places, some inputs have many
places and need to be rounded. Others are not supposed to have excess digits
and need to be validated. What methods should be used?
A. The :meth:`quantize` method rounds to a fixed number of decimal places. If
A. The :meth:`quantize` method rounds to a fixed number of decimal places. If
the :const:`Inexact` trap is set, it is also useful for validation::
>>> TWOPLACES = Decimal(10) ** -2 # same as Decimal('0.01')
@ -1191,36 +1191,36 @@ the :const:`Inexact` trap is set, it is also useful for validation::
...
Inexact: Changed in rounding
Q. Once I have valid two place inputs, how do I maintain that invariant
Q. Once I have valid two place inputs, how do I maintain that invariant
throughout an application?
A. Some operations like addition and subtraction automatically preserve fixed
A. Some operations like addition and subtraction automatically preserve fixed
point. Others, like multiplication and division, change the number of decimal
places and need to be followed-up with a :meth:`quantize` step.
Q. There are many ways to express the same value. The numbers :const:`200`,
Q. There are many ways to express the same value. The numbers :const:`200`,
:const:`200.000`, :const:`2E2`, and :const:`.02E+4` all have the same value at
various precisions. Is there a way to transform them to a single recognizable
canonical value?
A. The :meth:`normalize` method maps all equivalent values to a single
A. The :meth:`normalize` method maps all equivalent values to a single
representative::
>>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())
>>> [v.normalize() for v in values]
[Decimal("2E+2"), Decimal("2E+2"), Decimal("2E+2"), Decimal("2E+2")]
Q. Some decimal values always print with exponential notation. Is there a way
Q. Some decimal values always print with exponential notation. Is there a way
to get a non-exponential representation?
A. For some values, exponential notation is the only way to express the number
A. For some values, exponential notation is the only way to express the number
of significant places in the coefficient. For example, expressing
:const:`5.0E+3` as :const:`5000` keeps the value constant but cannot show the
original's two-place significance.
Q. Is there a way to convert a regular float to a :class:`Decimal`?
Q. Is there a way to convert a regular float to a :class:`Decimal`?
A. Yes, all binary floating point numbers can be exactly expressed as a
A. Yes, all binary floating point numbers can be exactly expressed as a
Decimal. An exact conversion may take more precision than intuition would
suggest, so trapping :const:`Inexact` will signal a need for more precision::
@ -1248,28 +1248,28 @@ suggest, so trapping :const:`Inexact` will signal a need for more precision::
finally:
setcontext(oldcontext)
Q. Why isn't the :func:`floatToDecimal` routine included in the module?
Q. Why isn't the :func:`floatToDecimal` routine included in the module?
A. There is some question about whether it is advisable to mix binary and
A. There is some question about whether it is advisable to mix binary and
decimal floating point. Also, its use requires some care to avoid the
representation issues associated with binary floating point::
>>> floatToDecimal(1.1)
Decimal("1.100000000000000088817841970012523233890533447265625")
Q. Within a complex calculation, how can I make sure that I haven't gotten a
Q. Within a complex calculation, how can I make sure that I haven't gotten a
spurious result because of insufficient precision or rounding anomalies.
A. The decimal module makes it easy to test results. A best practice is to re-
A. The decimal module makes it easy to test results. A best practice is to re-
run calculations using greater precision and with various rounding modes. Widely
differing results indicate insufficient precision, rounding mode issues, ill-
conditioned inputs, or a numerically unstable algorithm.
Q. I noticed that context precision is applied to the results of operations but
Q. I noticed that context precision is applied to the results of operations but
not to the inputs. Is there anything to watch out for when mixing values of
different precisions?
A. Yes. The principle is that all values are considered to be exact and so is
A. Yes. The principle is that all values are considered to be exact and so is
the arithmetic on those values. Only the results are rounded. The advantage
for inputs is that "what you type is what you get". A disadvantage is that the
results can look odd if you forget that the inputs haven't been rounded::

View File

@ -189,7 +189,7 @@ result back on the stack.
.. opcode:: UNARY_CONVERT ()
Implements ``TOS = `TOS``\ `.
Implements ``TOS = `TOS```.
.. opcode:: UNARY_INVERT ()

View File

@ -24,14 +24,13 @@ in this chapter is:
linecache.rst
shutil.rst
dircache.rst
Also see section :ref:`bltin-file-objects` for a description of Python's built-
in file objects.
.. % XXX can this be included in the seealso environment? --amk
.. seealso::
Section :ref:`bltin-file-objects`
A description of Python's built-in file objects.
Module :mod:`os`
Operating system interfaces, including functions to work with files at a lower
level than the built-in file object.

View File

@ -28,7 +28,7 @@ are translated to Python as follows:
* All arrays are represented by one-dimensional Python lists. In most cases,
tuples are also allowed.
* All string and character arguments are represented by Python strings, for
* All string and character arguments are represented by Python strings, for
instance, ``winopen('Hi There!')`` and ``rotate(900, 'z')``.
* All (short, long, unsigned) integer arguments or return values that are only

View File

@ -90,7 +90,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: add(a, b)
__add__(a, b)
Return *a* ``+`` *b*, for *a* and *b* numbers.
Return ``a + b``, for *a* and *b* numbers.
.. function:: and_(a, b)
@ -102,14 +102,14 @@ The mathematical and bitwise operations are the most numerous:
.. function:: div(a, b)
__div__(a, b)
Return *a* ``/`` *b* when ``__future__.division`` is not in effect. This is
Return ``a / b`` when ``__future__.division`` is not in effect. This is
also known as "classic" division.
.. function:: floordiv(a, b)
__floordiv__(a, b)
Return *a* ``//`` *b*.
Return ``a // b``.
.. versionadded:: 2.2
@ -119,7 +119,7 @@ The mathematical and bitwise operations are the most numerous:
__inv__(o)
__invert__(o)
Return the bitwise inverse of the number *o*. This is equivalent to ``~``*o*.
Return the bitwise inverse of the number *o*. This is equivalent to ``~o``.
The names :func:`invert` and :func:`__invert__` were added in Python 2.0.
@ -132,13 +132,13 @@ The mathematical and bitwise operations are the most numerous:
.. function:: mod(a, b)
__mod__(a, b)
Return *a* ``%`` *b*.
Return ``a % b``.
.. function:: mul(a, b)
__mul__(a, b)
Return *a* ``*`` *b*, for *a* and *b* numbers.
Return ``a * b``, for *a* and *b* numbers.
.. function:: neg(o)
@ -162,7 +162,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: pow(a, b)
__pow__(a, b)
Return *a* ``**`` *b*, for *a* and *b* numbers.
Return ``a ** b``, for *a* and *b* numbers.
.. versionadded:: 2.3
@ -176,13 +176,13 @@ The mathematical and bitwise operations are the most numerous:
.. function:: sub(a, b)
__sub__(a, b)
Return *a* ``-`` *b*.
Return ``a - b``.
.. function:: truediv(a, b)
__truediv__(a, b)
Return *a* ``/`` *b* when ``__future__.division`` is in effect. This is also
Return ``a / b`` when ``__future__.division`` is in effect. This is also
known as "true" division.
.. versionadded:: 2.2
@ -197,7 +197,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: index(a)
__index__(a)
Return *a* converted to an integer. Equivalent to *a*``.__index__()``.
Return *a* converted to an integer. Equivalent to ``a.__index__()``.
.. versionadded:: 2.5
@ -207,13 +207,13 @@ Operations which work with sequences include:
.. function:: concat(a, b)
__concat__(a, b)
Return *a* ``+`` *b* for *a* and *b* sequences.
Return ``a + b`` for *a* and *b* sequences.
.. function:: contains(a, b)
__contains__(a, b)
Return the outcome of the test *b* ``in`` *a*. Note the reversed operands. The
Return the outcome of the test ``b in a``. Note the reversed operands. The
name :func:`__contains__` was added in Python 2.0.
@ -231,7 +231,7 @@ Operations which work with sequences include:
.. function:: delslice(a, b, c)
__delslice__(a, b, c)
Delete the slice of *a* from index *b* to index *c*``-1``.
Delete the slice of *a* from index *b* to index *c-1*.
.. function:: getitem(a, b)
@ -243,7 +243,7 @@ Operations which work with sequences include:
.. function:: getslice(a, b, c)
__getslice__(a, b, c)
Return the slice of *a* from index *b* to index *c*``-1``.
Return the slice of *a* from index *b* to index *c-1*.
.. function:: indexOf(a, b)
@ -254,7 +254,7 @@ Operations which work with sequences include:
.. function:: repeat(a, b)
__repeat__(a, b)
Return *a* ``*`` *b* where *a* is a sequence and *b* is an integer.
Return ``a * b`` where *a* is a sequence and *b* is an integer.
.. function:: sequenceIncludes(...)
@ -274,7 +274,7 @@ Operations which work with sequences include:
.. function:: setslice(a, b, c, v)
__setslice__(a, b, c, v)
Set the slice of *a* from index *b* to index *c*``-1`` to the sequence *v*.
Set the slice of *a* from index *b* to index *c-1* to the sequence *v*.
Many operations have an "in-place" version. The following functions provide a
more primitive access to in-place operators than the usual syntax does; for
@ -405,24 +405,23 @@ to the compound statement ``z = x; z += y``.
.. versionadded:: 2.5
The :mod:`operator` module also defines a few predicates to test the type of
objects.
.. note::
Be careful not to misinterpret the results of these functions; only
:func:`isCallable` has any measure of reliability with instance objects. For
example:
:func:`isCallable` has any measure of reliability with instance objects.
For example::
::
>>> class C:
... pass
...
>>> import operator
>>> o = C()
>>> operator.isMappingType(o)
True
>>> class C:
... pass
...
>>> import operator
>>> o = C()
>>> operator.isMappingType(o)
True
.. function:: isCallable(o)

View File

@ -117,18 +117,18 @@ option
Some other option syntaxes that the world has seen include:
* a hyphen followed by a few letters, e.g. ``"-pf"`` (this is *not* the same
as multiple options merged into a single argument)
* a hyphen followed by a few letters, e.g. ``"-pf"`` (this is *not* the same
as multiple options merged into a single argument)
* a hyphen followed by a whole word, e.g. ``"-file"`` (this is technically
equivalent to the previous syntax, but they aren't usually seen in the same
program)
* a hyphen followed by a whole word, e.g. ``"-file"`` (this is technically
equivalent to the previous syntax, but they aren't usually seen in the same
program)
* a plus sign followed by a single letter, or a few letters, or a word, e.g.
``"+f"``, ``"+rgb"``
* a plus sign followed by a single letter, or a few letters, or a word, e.g.
``"+f"``, ``"+rgb"``
* a slash followed by a letter, or a few letters, or a word, e.g. ``"/f"``,
``"/file"``
* a slash followed by a letter, or a few letters, or a word, e.g. ``"/f"``,
``"/file"``
These option syntaxes are not supported by :mod:`optparse`, and they never will
be. This is deliberate: the first three are non-standard on any environment,
@ -289,12 +289,12 @@ that's rarely necessary: by default it uses ``sys.argv[1:]``.)
:meth:`parse_args` returns two values:
* ``options``, an object containing values for all of your options---e.g. if
* ``options``, an object containing values for all of your options---e.g. if
``"--file"`` takes a single string argument, then ``options.file`` will be the
filename supplied by the user, or ``None`` if the user did not supply that
option
* ``args``, the list of positional arguments leftover after parsing options
* ``args``, the list of positional arguments leftover after parsing options
This tutorial section only covers the four most important option attributes:
:attr:`action`, :attr:`type`, :attr:`dest` (destination), and :attr:`help`. Of
@ -510,7 +510,7 @@ printing the help text.)
There's a lot going on here to help :mod:`optparse` generate the best possible
help message:
* the script defines its own usage message::
* the script defines its own usage message::
usage = "usage: %prog [options] arg1 arg2"
@ -522,11 +522,11 @@ help message:
default: ``"usage: %prog [options]"``, which is fine if your script doesn't take
any positional arguments.
* every option defines a help string, and doesn't worry about line-
* every option defines a help string, and doesn't worry about line-
wrapping---\ :mod:`optparse` takes care of wrapping lines and making the help
output look good.
* options that take a value indicate this fact in their automatically-
* options that take a value indicate this fact in their automatically-
generated help message, e.g. for the "mode" option::
-m MODE, --mode=MODE
@ -546,7 +546,7 @@ help message:
description "write output to FILE". This is a simple but effective way to make
your help text a lot clearer and more useful for end users.
* options that have a default value can include ``%default`` in the help
* options that have a default value can include ``%default`` in the help
string---\ :mod:`optparse` will replace it with :func:`str` of the option's
default value. If an option has no default value (or the default value is
``None``), ``%default`` expands to ``none``.
@ -737,9 +737,9 @@ is by using ``OptionParser.add_option()``, as shown in section
:ref:`optparse-tutorial`, the tutorial. :meth:`add_option` can be called in one
of two ways:
* pass it an Option instance (as returned by :func:`make_option`)
* pass it an Option instance (as returned by :func:`make_option`)
* pass it any combination of positional and keyword arguments that are
* pass it any combination of positional and keyword arguments that are
acceptable to :func:`make_option` (i.e., to the Option constructor), and it will
create the Option instance for you
@ -866,7 +866,7 @@ Most actions have several relevant option attributes which you may specify to
guide :mod:`optparse`'s behaviour; a few have required attributes, which you
must specify for any option using that action.
* ``store`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
* ``store`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
The option must be followed by an argument, which is converted to a value
according to :attr:`type` and stored in :attr:`dest`. If ``nargs`` > 1,
@ -899,7 +899,7 @@ must specify for any option using that action.
options.point = (1.0, -3.5, 4.0)
options.f = "bar.txt"
* ``store_const`` [required: ``const``; relevant: :attr:`dest`]
* ``store_const`` [required: ``const``; relevant: :attr:`dest`]
The value ``const`` is stored in :attr:`dest`.
@ -916,11 +916,11 @@ must specify for any option using that action.
options.verbose = 2
* ``store_true`` [relevant: :attr:`dest`]
* ``store_true`` [relevant: :attr:`dest`]
A special case of ``store_const`` that stores a true value to :attr:`dest`.
* ``store_false`` [relevant: :attr:`dest`]
* ``store_false`` [relevant: :attr:`dest`]
Like ``store_true``, but stores a false value.
@ -929,7 +929,7 @@ must specify for any option using that action.
parser.add_option("--clobber", action="store_true", dest="clobber")
parser.add_option("--no-clobber", action="store_false", dest="clobber")
* ``append`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
* ``append`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
The option must be followed by an argument, which is appended to the list in
:attr:`dest`. If no default value for :attr:`dest` is supplied, an empty list
@ -954,13 +954,13 @@ must specify for any option using that action.
options.tracks.append(int("4"))
* ``append_const`` [required: ``const``; relevant: :attr:`dest`]
* ``append_const`` [required: ``const``; relevant: :attr:`dest`]
Like ``store_const``, but the value ``const`` is appended to :attr:`dest`; as
with ``append``, :attr:`dest` defaults to ``None``, and an an empty list is
automatically created the first time the option is encountered.
* ``count`` [relevant: :attr:`dest`]
* ``count`` [relevant: :attr:`dest`]
Increment the integer stored at :attr:`dest`. If no default value is supplied,
:attr:`dest` is set to zero before being incremented the first time.
@ -979,7 +979,7 @@ must specify for any option using that action.
options.verbosity += 1
* ``callback`` [required: ``callback``; relevant: :attr:`type`, ``nargs``,
* ``callback`` [required: ``callback``; relevant: :attr:`type`, ``nargs``,
``callback_args``, ``callback_kwargs``]
Call the function specified by ``callback``, which is called as ::
@ -988,7 +988,7 @@ must specify for any option using that action.
See section :ref:`optparse-option-callbacks`, Option Callbacks for more detail.
* :attr:`help`
* :attr:`help`
Prints a complete help message for all the options in the current option parser.
The help message is constructed from the ``usage`` string passed to
@ -1027,7 +1027,7 @@ must specify for any option using that action.
After printing the help message, :mod:`optparse` terminates your process with
``sys.exit(0)``.
* ``version``
* ``version``
Prints the version number supplied to the OptionParser to stdout and exits. The
version number is actually formatted and printed by the ``print_version()``
@ -1047,59 +1047,59 @@ The following option attributes may be passed as keyword arguments to
to a particular option, or fail to pass a required option attribute,
:mod:`optparse` raises OptionError.
* :attr:`action` (default: ``"store"``)
* :attr:`action` (default: ``"store"``)
Determines :mod:`optparse`'s behaviour when this option is seen on the command
line; the available options are documented above.
* :attr:`type` (default: ``"string"``)
* :attr:`type` (default: ``"string"``)
The argument type expected by this option (e.g., ``"string"`` or ``"int"``); the
available option types are documented below.
* :attr:`dest` (default: derived from option strings)
* :attr:`dest` (default: derived from option strings)
If the option's action implies writing or modifying a value somewhere, this
tells :mod:`optparse` where to write it: :attr:`dest` names an attribute of the
``options`` object that :mod:`optparse` builds as it parses the command line.
* ``default`` (deprecated)
* ``default`` (deprecated)
The value to use for this option's destination if the option is not seen on the
command line. Deprecated; use ``parser.set_defaults()`` instead.
* ``nargs`` (default: 1)
* ``nargs`` (default: 1)
How many arguments of type :attr:`type` should be consumed when this option is
seen. If > 1, :mod:`optparse` will store a tuple of values to :attr:`dest`.
* ``const``
* ``const``
For actions that store a constant value, the constant value to store.
* ``choices``
* ``choices``
For options of type ``"choice"``, the list of strings the user may choose from.
* ``callback``
* ``callback``
For options with action ``"callback"``, the callable to call when this option is
seen. See section :ref:`optparse-option-callbacks`, Option Callbacks for detail
on the arguments passed to ``callable``.
* ``callback_args``, ``callback_kwargs``
* ``callback_args``, ``callback_kwargs``
Additional positional and keyword arguments to pass to ``callback`` after the
four standard callback arguments.
* :attr:`help`
* :attr:`help`
Help text to print for this option when listing all available options after the
user supplies a :attr:`help` option (such as ``"--help"``). If no help text is
supplied, the option will be listed without help text. To hide this option, use
the special value ``SUPPRESS_HELP``.
* ``metavar`` (default: derived from option strings)
* ``metavar`` (default: derived from option strings)
Stand-in for the option argument(s) to use when printing help text. See section
:ref:`optparse-tutorial`, the tutorial for an example.
@ -1119,13 +1119,13 @@ the command line is stored in the destination (or passed to the callback) as-is.
Integer arguments (type ``int`` or ``long``) are parsed as follows:
* if the number starts with ``0x``, it is parsed as a hexadecimal number
* if the number starts with ``0x``, it is parsed as a hexadecimal number
* if the number starts with ``0``, it is parsed as an octal number
* if the number starts with ``0``, it is parsed as an octal number
* if the number starts with ``0b``, is is parsed as a binary number
* if the number starts with ``0b``, is is parsed as a binary number
* otherwise, the number is parsed as a decimal number
* otherwise, the number is parsed as a decimal number
The conversion is done by calling either ``int()`` or ``long()`` with the
@ -1290,13 +1290,13 @@ Other methods
OptionParser supports several other public methods:
* ``set_usage(usage)``
* ``set_usage(usage)``
Set the usage string according to the rules described above for the ``usage``
constructor keyword argument. Passing ``None`` sets the default usage string;
use ``SUPPRESS_USAGE`` to suppress a usage message.
* ``enable_interspersed_args()``, ``disable_interspersed_args()``
* ``enable_interspersed_args()``, ``disable_interspersed_args()``
Enable/disable positional arguments interspersed with options, similar to GNU
getopt (enabled by default). For example, if ``"-a"`` and ``"-b"`` are both
@ -1313,7 +1313,7 @@ OptionParser supports several other public methods:
traditional Unix syntax, where option parsing stops with the first non-option
argument.
* ``set_defaults(dest=value, ...)``
* ``set_defaults(dest=value, ...)``
Set default values for several option destinations at once. Using
:meth:`set_defaults` is the preferred way to set default values for options,
@ -1351,9 +1351,9 @@ cases. Quite often a simple callback is all you need.
There are two steps to defining a callback option:
* define the option itself using the ``callback`` action
* define the option itself using the ``callback`` action
* write the callback; this is a function (or method) that takes at least four
* write the callback; this is a function (or method) that takes at least four
arguments, as described below
@ -1586,12 +1586,12 @@ conventional Unix command-line parsing that :mod:`optparse` normally handles for
you. In particular, callbacks should implement the conventional rules for bare
``"--"`` and ``"-"`` arguments:
* either ``"--"`` or ``"-"`` can be option arguments
* either ``"--"`` or ``"-"`` can be option arguments
* bare ``"--"`` (if not the argument to some option): halt command-line
* bare ``"--"`` (if not the argument to some option): halt command-line
processing and discard the ``"--"``
* bare ``"-"`` (if not the argument to some option): halt command-line
* bare ``"-"`` (if not the argument to some option): halt command-line
processing but keep the ``"-"`` (append it to ``parser.largs``)
If you want an option that takes a variable number of arguments, there are
@ -1799,18 +1799,18 @@ Again we define a subclass of Option::
Features of note:
* ``extend`` both expects a value on the command-line and stores that value
* ``extend`` both expects a value on the command-line and stores that value
somewhere, so it goes in both :attr:`STORE_ACTIONS` and :attr:`TYPED_ACTIONS`
* to ensure that :mod:`optparse` assigns the default type of ``string`` to
* to ensure that :mod:`optparse` assigns the default type of ``string`` to
``extend`` actions, we put the ``extend`` action in ``ALWAYS_TYPED_ACTIONS`` as
well
* :meth:`MyOption.take_action` implements just this one new action, and passes
* :meth:`MyOption.take_action` implements just this one new action, and passes
control back to :meth:`Option.take_action` for the standard :mod:`optparse`
actions
* ``values`` is an instance of the optparse_parser.Values class, which
* ``values`` is an instance of the optparse_parser.Values class, which
provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` is
essentially :func:`getattr` with a safety valve; it is called as ::

View File

@ -766,10 +766,10 @@ func
are commonly known as *callbacks*.)
add
is optional, either ```` or``\ +``. Passing an empty string denotes that this
binding is to replace any other bindings that this event is associated with.
Preceeding with a``\ +`` means that this function is to be added to the list of
functions bound to this event type.
is optional, either ``''`` or ``'+'``. Passing an empty string denotes that
this binding is to replace any other bindings that this event is associated
with. Passing a ``'+'`` means that this function is to be added to the list
of functions bound to this event type.
For example::

View File

@ -62,10 +62,10 @@ The :mod:`urllib2` module defines the following functions:
.. function:: build_opener([handler, ...])
Return an :class:`OpenerDirector` instance, which chains the handlers in the
order given. *handler*s can be either instances of :class:`BaseHandler`, or
order given. *handler*\s can be either instances of :class:`BaseHandler`, or
subclasses of :class:`BaseHandler` (in which case it must be possible to call
the constructor without any parameters). Instances of the following classes
will be in front of the *handler*s, unless the *handler*s contain them,
will be in front of the *handler*\s, unless the *handler*\s contain them,
instances of them or subclasses of them: :class:`ProxyHandler`,
:class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`,
:class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`,

View File

@ -1,6 +1,5 @@
:mod:`xml.etree` --- The ElementTree API for XML
=================================================
:mod:`xml.etree` --- The ElementTree API for XML
================================================
.. module:: xml.etree
:synopsis: Package containing common ElementTree modules.
@ -23,4 +22,3 @@ this package contains the :mod:`ElementTree`, :mod:`ElementPath`, and
`ElementTree Overview <http://effbot.org/tag/elementtree>`_
The home page for :mod:`ElementTree`. This includes links to additional
documentation, alternative implementations, and other add-ons.

View File

@ -77,7 +77,7 @@ The :mod:`EasyDialogs` module defines the following functions:
options are selected. Its items can take one of two forms: *optstr* or
``(optstr, descr)``. When present, *descr* is a short descriptive string that
is displayed in the dialog while this option is selected in the popup menu. The
correspondence between *optstr*s and command-line arguments is:
correspondence between *optstr*\s and command-line arguments is:
+----------------------+------------------------------------------+
| *optstr* format | Command-line format |

View File

@ -86,12 +86,7 @@ following modules are relevant to MacPython AppleScript support:
aepack.rst
aetypes.rst
miniae.rst
In addition, support modules have been pre-generated for :mod:`Finder`,
:mod:`Terminal`, :mod:`Explorer`, :mod:`Netscape`, :mod:`CodeWarrior`,
:mod:`SystemEvents` and :mod:`StdSuites`.
XXX: input{libgensuitemodule} :XXX
XXX: input{libaetools} :XXX
XXX: input{libaepack} :XXX
XXX: input{libaetypes} :XXX
XXX: input{libminiae} :XXX

View File

@ -2,7 +2,6 @@ To do after conversion
======================
* fix all references and links marked with `XXX`
* adjust all literal include paths
* fix all duplicate labels and undefined label references
* split very large files and add toctrees
* integrate standalone HOWTOs

View File

@ -1,9 +1,9 @@
.. _reporting-bugs:
**************
Reporting Bugs
**************
.. _reporting-bugs:
Python is a mature programming language which has established a reputation for
stability. In order to maintain this reputation, the developers would like to
know of any deficiencies you find in Python or its documentation.

View File

@ -3157,15 +3157,15 @@ objects.
.. cfunction:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))
Create a :ctype:`PyCObject` from the ``void *``*cobj*. The *destr* function
Create a :ctype:`PyCObject` from the ``void *`` *cobj*. The *destr* function
will be called when the object is reclaimed, unless it is *NULL*.
.. cfunction:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *))
Create a :ctype:`PyCObject` from the :ctype:`void \*`*cobj*. The *destr*
function will be called when the object is reclaimed. The *desc* argument can be
used to pass extra callback data for the destructor function.
Create a :ctype:`PyCObject` from the :ctype:`void \*` *cobj*. The *destr*
function will be called when the object is reclaimed. The *desc* argument can
be used to pass extra callback data for the destructor function.
.. cfunction:: void* PyCObject_AsVoidPtr(PyObject* self)

View File

@ -204,7 +204,7 @@ Initialization, Finalization, and Threads
.. cfunction:: char* Py_GetExecPrefix()
Return the *exec-prefix* for installed platform-*de*pendent files. This is
Return the *exec-prefix* for installed platform-*dependent* files. This is
derived through a number of complicated rules from the program name set with
:cfunc:`Py_SetProgramName` and some environment variables; for example, if the
program name is ``'/usr/local/bin/python'``, the exec-prefix is

View File

@ -624,9 +624,9 @@ variable(s) whose address should be passed.
Convert a Python object to a C variable through a *converter* function. This
takes two arguments: the first is a function, the second is the address of a C
variable (of arbitrary type), converted to :ctype:`void \*`. The *converter*
function in turn is called as follows:
function in turn is called as follows::
*status*``=``*converter*``(``*object*, *address*``);``
status = converter(object, address);
where *object* is the Python object to be converted and *address* is the
:ctype:`void\*` argument that was passed to the :cfunc:`PyArg_Parse\*` function.

View File

@ -68,15 +68,15 @@ described here are distributed with the Python sources in the
#. **Build the example DLL** --- In order to check that everything is set up
right, try building:
#. Select a configuration. This step is optional. Choose :menuselection:`Build
--> Configuration Manager --> Active Solution Configuration` and select either
:guilabel:`Release` or\ :guilabel:`Debug`. If you skip this step, VC++ will
use the Debug configuration by default.
#. Select a configuration. This step is optional. Choose
:menuselection:`Build --> Configuration Manager --> Active Solution Configuration`
and select either :guilabel:`Release` or :guilabel:`Debug`. If you skip this
step, VC++ will use the Debug configuration by default.
#. Build the DLL. Choose :menuselection:`Build --> Build Solution`. This
creates all intermediate and result files in a subdirectory called either
:file:`Debug` or :file:`Release`, depending on which configuration you selected
in the preceding step.
creates all intermediate and result files in a subdirectory called either
:file:`Debug` or :file:`Release`, depending on which configuration you selected
in the preceding step.
#. **Testing the debug-mode DLL** --- Once the Debug build has succeeded, bring
up a DOS box, and change to the :file:`example_nt\\Debug` directory. You should

View File

@ -1103,7 +1103,7 @@ the following methods:
Pretend *count* lines have been changed, starting with line *start*. If
*changed* is supplied, it specifies whether the affected lines are marked as
having been changed (*changed*=1) or unchanged (*changed*=0).
having been changed (*changed*\ =1) or unchanged (*changed*\ =0).
.. method:: window.touchwin()

View File

@ -1160,20 +1160,20 @@ to work with the :class:`Decimal` class::
Decimal FAQ
-----------
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to
minimize typing when using the interactive interpreter?
A. Some users abbreviate the constructor to just a single letter::
\A. Some users abbreviate the constructor to just a single letter::
>>> D = decimal.Decimal
>>> D('1.23') + D('3.45')
Decimal("4.68")
Q. In a fixed-point application with two decimal places, some inputs have many
Q. In a fixed-point application with two decimal places, some inputs have many
places and need to be rounded. Others are not supposed to have excess digits
and need to be validated. What methods should be used?
A. The :meth:`quantize` method rounds to a fixed number of decimal places. If
A. The :meth:`quantize` method rounds to a fixed number of decimal places. If
the :const:`Inexact` trap is set, it is also useful for validation::
>>> TWOPLACES = Decimal(10) ** -2 # same as Decimal('0.01')
@ -1191,36 +1191,36 @@ the :const:`Inexact` trap is set, it is also useful for validation::
...
Inexact: Changed in rounding
Q. Once I have valid two place inputs, how do I maintain that invariant
Q. Once I have valid two place inputs, how do I maintain that invariant
throughout an application?
A. Some operations like addition and subtraction automatically preserve fixed
A. Some operations like addition and subtraction automatically preserve fixed
point. Others, like multiplication and division, change the number of decimal
places and need to be followed-up with a :meth:`quantize` step.
Q. There are many ways to express the same value. The numbers :const:`200`,
Q. There are many ways to express the same value. The numbers :const:`200`,
:const:`200.000`, :const:`2E2`, and :const:`.02E+4` all have the same value at
various precisions. Is there a way to transform them to a single recognizable
canonical value?
A. The :meth:`normalize` method maps all equivalent values to a single
A. The :meth:`normalize` method maps all equivalent values to a single
representative::
>>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())
>>> [v.normalize() for v in values]
[Decimal("2E+2"), Decimal("2E+2"), Decimal("2E+2"), Decimal("2E+2")]
Q. Some decimal values always print with exponential notation. Is there a way
Q. Some decimal values always print with exponential notation. Is there a way
to get a non-exponential representation?
A. For some values, exponential notation is the only way to express the number
A. For some values, exponential notation is the only way to express the number
of significant places in the coefficient. For example, expressing
:const:`5.0E+3` as :const:`5000` keeps the value constant but cannot show the
original's two-place significance.
Q. Is there a way to convert a regular float to a :class:`Decimal`?
Q. Is there a way to convert a regular float to a :class:`Decimal`?
A. Yes, all binary floating point numbers can be exactly expressed as a
A. Yes, all binary floating point numbers can be exactly expressed as a
Decimal. An exact conversion may take more precision than intuition would
suggest, so trapping :const:`Inexact` will signal a need for more precision::
@ -1248,28 +1248,28 @@ suggest, so trapping :const:`Inexact` will signal a need for more precision::
finally:
setcontext(oldcontext)
Q. Why isn't the :func:`floatToDecimal` routine included in the module?
Q. Why isn't the :func:`floatToDecimal` routine included in the module?
A. There is some question about whether it is advisable to mix binary and
A. There is some question about whether it is advisable to mix binary and
decimal floating point. Also, its use requires some care to avoid the
representation issues associated with binary floating point::
>>> floatToDecimal(1.1)
Decimal("1.100000000000000088817841970012523233890533447265625")
Q. Within a complex calculation, how can I make sure that I haven't gotten a
Q. Within a complex calculation, how can I make sure that I haven't gotten a
spurious result because of insufficient precision or rounding anomalies.
A. The decimal module makes it easy to test results. A best practice is to re-
A. The decimal module makes it easy to test results. A best practice is to re-
run calculations using greater precision and with various rounding modes. Widely
differing results indicate insufficient precision, rounding mode issues, ill-
conditioned inputs, or a numerically unstable algorithm.
Q. I noticed that context precision is applied to the results of operations but
Q. I noticed that context precision is applied to the results of operations but
not to the inputs. Is there anything to watch out for when mixing values of
different precisions?
A. Yes. The principle is that all values are considered to be exact and so is
A. Yes. The principle is that all values are considered to be exact and so is
the arithmetic on those values. Only the results are rounded. The advantage
for inputs is that "what you type is what you get". A disadvantage is that the
results can look odd if you forget that the inputs haven't been rounded::

View File

@ -24,14 +24,13 @@ in this chapter is:
linecache.rst
shutil.rst
dircache.rst
Also see section :ref:`bltin-file-objects` for a description of Python's built-
in file objects.
.. % XXX can this be included in the seealso environment? --amk
.. seealso::
Section :ref:`bltin-file-objects`
A description of Python's built-in file objects.
Module :mod:`os`
Operating system interfaces, including functions to work with files at a lower
level than the built-in file object.

View File

@ -90,7 +90,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: add(a, b)
__add__(a, b)
Return *a* ``+`` *b*, for *a* and *b* numbers.
Return ``a + b``, for *a* and *b* numbers.
.. function:: and_(a, b)
@ -102,14 +102,14 @@ The mathematical and bitwise operations are the most numerous:
.. function:: div(a, b)
__div__(a, b)
Return *a* ``/`` *b* when ``__future__.division`` is not in effect. This is
Return ``a / b`` when ``__future__.division`` is not in effect. This is
also known as "classic" division.
.. function:: floordiv(a, b)
__floordiv__(a, b)
Return *a* ``//`` *b*.
Return ``a // b``.
.. versionadded:: 2.2
@ -119,7 +119,7 @@ The mathematical and bitwise operations are the most numerous:
__inv__(o)
__invert__(o)
Return the bitwise inverse of the number *o*. This is equivalent to ``~``*o*.
Return the bitwise inverse of the number *o*. This is equivalent to ``~o``.
The names :func:`invert` and :func:`__invert__` were added in Python 2.0.
@ -132,13 +132,13 @@ The mathematical and bitwise operations are the most numerous:
.. function:: mod(a, b)
__mod__(a, b)
Return *a* ``%`` *b*.
Return ``a % b``.
.. function:: mul(a, b)
__mul__(a, b)
Return *a* ``*`` *b*, for *a* and *b* numbers.
Return ``a * b``, for *a* and *b* numbers.
.. function:: neg(o)
@ -162,7 +162,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: pow(a, b)
__pow__(a, b)
Return *a* ``**`` *b*, for *a* and *b* numbers.
Return ``a ** b``, for *a* and *b* numbers.
.. versionadded:: 2.3
@ -176,13 +176,13 @@ The mathematical and bitwise operations are the most numerous:
.. function:: sub(a, b)
__sub__(a, b)
Return *a* ``-`` *b*.
Return ``a - b``.
.. function:: truediv(a, b)
__truediv__(a, b)
Return *a* ``/`` *b* when ``__future__.division`` is in effect. This is also
Return ``a / b`` when ``__future__.division`` is in effect. This is also
known as "true" division.
.. versionadded:: 2.2
@ -197,7 +197,7 @@ The mathematical and bitwise operations are the most numerous:
.. function:: index(a)
__index__(a)
Return *a* converted to an integer. Equivalent to *a*``.__index__()``.
Return *a* converted to an integer. Equivalent to ``a.__index__()``.
.. versionadded:: 2.5
@ -207,13 +207,13 @@ Operations which work with sequences include:
.. function:: concat(a, b)
__concat__(a, b)
Return *a* ``+`` *b* for *a* and *b* sequences.
Return ``a + b`` for *a* and *b* sequences.
.. function:: contains(a, b)
__contains__(a, b)
Return the outcome of the test *b* ``in`` *a*. Note the reversed operands. The
Return the outcome of the test ``b in a``. Note the reversed operands. The
name :func:`__contains__` was added in Python 2.0.
@ -231,7 +231,7 @@ Operations which work with sequences include:
.. function:: delslice(a, b, c)
__delslice__(a, b, c)
Delete the slice of *a* from index *b* to index *c*``-1``.
Delete the slice of *a* from index *b* to index *c-1*.
.. function:: getitem(a, b)
@ -243,7 +243,7 @@ Operations which work with sequences include:
.. function:: getslice(a, b, c)
__getslice__(a, b, c)
Return the slice of *a* from index *b* to index *c*``-1``.
Return the slice of *a* from index *b* to index *c-1*.
.. function:: indexOf(a, b)
@ -254,7 +254,7 @@ Operations which work with sequences include:
.. function:: repeat(a, b)
__repeat__(a, b)
Return *a* ``*`` *b* where *a* is a sequence and *b* is an integer.
Return ``a * b`` where *a* is a sequence and *b* is an integer.
.. function:: sequenceIncludes(...)
@ -274,7 +274,7 @@ Operations which work with sequences include:
.. function:: setslice(a, b, c, v)
__setslice__(a, b, c, v)
Set the slice of *a* from index *b* to index *c*``-1`` to the sequence *v*.
Set the slice of *a* from index *b* to index *c-1* to the sequence *v*.
Many operations have an "in-place" version. The following functions provide a
more primitive access to in-place operators than the usual syntax does; for
@ -405,24 +405,23 @@ to the compound statement ``z = x; z += y``.
.. versionadded:: 2.5
The :mod:`operator` module also defines a few predicates to test the type of
objects.
.. note::
Be careful not to misinterpret the results of these functions; only
:func:`isCallable` has any measure of reliability with instance objects. For
example:
:func:`isCallable` has any measure of reliability with instance objects.
For example::
::
>>> class C:
... pass
...
>>> import operator
>>> o = C()
>>> operator.isMappingType(o)
True
>>> class C:
... pass
...
>>> import operator
>>> o = C()
>>> operator.isMappingType(o)
True
.. function:: isCallable(o)

View File

@ -117,18 +117,18 @@ option
Some other option syntaxes that the world has seen include:
* a hyphen followed by a few letters, e.g. ``"-pf"`` (this is *not* the same
as multiple options merged into a single argument)
* a hyphen followed by a few letters, e.g. ``"-pf"`` (this is *not* the same
as multiple options merged into a single argument)
* a hyphen followed by a whole word, e.g. ``"-file"`` (this is technically
equivalent to the previous syntax, but they aren't usually seen in the same
program)
* a hyphen followed by a whole word, e.g. ``"-file"`` (this is technically
equivalent to the previous syntax, but they aren't usually seen in the same
program)
* a plus sign followed by a single letter, or a few letters, or a word, e.g.
``"+f"``, ``"+rgb"``
* a plus sign followed by a single letter, or a few letters, or a word, e.g.
``"+f"``, ``"+rgb"``
* a slash followed by a letter, or a few letters, or a word, e.g. ``"/f"``,
``"/file"``
* a slash followed by a letter, or a few letters, or a word, e.g. ``"/f"``,
``"/file"``
These option syntaxes are not supported by :mod:`optparse`, and they never will
be. This is deliberate: the first three are non-standard on any environment,
@ -289,12 +289,12 @@ that's rarely necessary: by default it uses ``sys.argv[1:]``.)
:meth:`parse_args` returns two values:
* ``options``, an object containing values for all of your options---e.g. if
* ``options``, an object containing values for all of your options---e.g. if
``"--file"`` takes a single string argument, then ``options.file`` will be the
filename supplied by the user, or ``None`` if the user did not supply that
option
* ``args``, the list of positional arguments leftover after parsing options
* ``args``, the list of positional arguments leftover after parsing options
This tutorial section only covers the four most important option attributes:
:attr:`action`, :attr:`type`, :attr:`dest` (destination), and :attr:`help`. Of
@ -510,7 +510,7 @@ printing the help text.)
There's a lot going on here to help :mod:`optparse` generate the best possible
help message:
* the script defines its own usage message::
* the script defines its own usage message::
usage = "usage: %prog [options] arg1 arg2"
@ -522,11 +522,11 @@ help message:
default: ``"usage: %prog [options]"``, which is fine if your script doesn't take
any positional arguments.
* every option defines a help string, and doesn't worry about line-
* every option defines a help string, and doesn't worry about line-
wrapping---\ :mod:`optparse` takes care of wrapping lines and making the help
output look good.
* options that take a value indicate this fact in their automatically-
* options that take a value indicate this fact in their automatically-
generated help message, e.g. for the "mode" option::
-m MODE, --mode=MODE
@ -546,7 +546,7 @@ help message:
description "write output to FILE". This is a simple but effective way to make
your help text a lot clearer and more useful for end users.
* options that have a default value can include ``%default`` in the help
* options that have a default value can include ``%default`` in the help
string---\ :mod:`optparse` will replace it with :func:`str` of the option's
default value. If an option has no default value (or the default value is
``None``), ``%default`` expands to ``none``.
@ -737,9 +737,9 @@ is by using ``OptionParser.add_option()``, as shown in section
:ref:`optparse-tutorial`, the tutorial. :meth:`add_option` can be called in one
of two ways:
* pass it an Option instance (as returned by :func:`make_option`)
* pass it an Option instance (as returned by :func:`make_option`)
* pass it any combination of positional and keyword arguments that are
* pass it any combination of positional and keyword arguments that are
acceptable to :func:`make_option` (i.e., to the Option constructor), and it will
create the Option instance for you
@ -866,7 +866,7 @@ Most actions have several relevant option attributes which you may specify to
guide :mod:`optparse`'s behaviour; a few have required attributes, which you
must specify for any option using that action.
* ``store`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
* ``store`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
The option must be followed by an argument, which is converted to a value
according to :attr:`type` and stored in :attr:`dest`. If ``nargs`` > 1,
@ -899,7 +899,7 @@ must specify for any option using that action.
options.point = (1.0, -3.5, 4.0)
options.f = "bar.txt"
* ``store_const`` [required: ``const``; relevant: :attr:`dest`]
* ``store_const`` [required: ``const``; relevant: :attr:`dest`]
The value ``const`` is stored in :attr:`dest`.
@ -916,11 +916,11 @@ must specify for any option using that action.
options.verbose = 2
* ``store_true`` [relevant: :attr:`dest`]
* ``store_true`` [relevant: :attr:`dest`]
A special case of ``store_const`` that stores a true value to :attr:`dest`.
* ``store_false`` [relevant: :attr:`dest`]
* ``store_false`` [relevant: :attr:`dest`]
Like ``store_true``, but stores a false value.
@ -929,7 +929,7 @@ must specify for any option using that action.
parser.add_option("--clobber", action="store_true", dest="clobber")
parser.add_option("--no-clobber", action="store_false", dest="clobber")
* ``append`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
* ``append`` [relevant: :attr:`type`, :attr:`dest`, ``nargs``, ``choices``]
The option must be followed by an argument, which is appended to the list in
:attr:`dest`. If no default value for :attr:`dest` is supplied, an empty list
@ -954,13 +954,13 @@ must specify for any option using that action.
options.tracks.append(int("4"))
* ``append_const`` [required: ``const``; relevant: :attr:`dest`]
* ``append_const`` [required: ``const``; relevant: :attr:`dest`]
Like ``store_const``, but the value ``const`` is appended to :attr:`dest`; as
with ``append``, :attr:`dest` defaults to ``None``, and an an empty list is
automatically created the first time the option is encountered.
* ``count`` [relevant: :attr:`dest`]
* ``count`` [relevant: :attr:`dest`]
Increment the integer stored at :attr:`dest`. If no default value is supplied,
:attr:`dest` is set to zero before being incremented the first time.
@ -979,7 +979,7 @@ must specify for any option using that action.
options.verbosity += 1
* ``callback`` [required: ``callback``; relevant: :attr:`type`, ``nargs``,
* ``callback`` [required: ``callback``; relevant: :attr:`type`, ``nargs``,
``callback_args``, ``callback_kwargs``]
Call the function specified by ``callback``, which is called as ::
@ -988,7 +988,7 @@ must specify for any option using that action.
See section :ref:`optparse-option-callbacks`, Option Callbacks for more detail.
* :attr:`help`
* :attr:`help`
Prints a complete help message for all the options in the current option parser.
The help message is constructed from the ``usage`` string passed to
@ -1027,7 +1027,7 @@ must specify for any option using that action.
After printing the help message, :mod:`optparse` terminates your process with
``sys.exit(0)``.
* ``version``
* ``version``
Prints the version number supplied to the OptionParser to stdout and exits. The
version number is actually formatted and printed by the ``print_version()``
@ -1047,59 +1047,59 @@ The following option attributes may be passed as keyword arguments to
to a particular option, or fail to pass a required option attribute,
:mod:`optparse` raises OptionError.
* :attr:`action` (default: ``"store"``)
* :attr:`action` (default: ``"store"``)
Determines :mod:`optparse`'s behaviour when this option is seen on the command
line; the available options are documented above.
* :attr:`type` (default: ``"string"``)
* :attr:`type` (default: ``"string"``)
The argument type expected by this option (e.g., ``"string"`` or ``"int"``); the
available option types are documented below.
* :attr:`dest` (default: derived from option strings)
* :attr:`dest` (default: derived from option strings)
If the option's action implies writing or modifying a value somewhere, this
tells :mod:`optparse` where to write it: :attr:`dest` names an attribute of the
``options`` object that :mod:`optparse` builds as it parses the command line.
* ``default`` (deprecated)
* ``default`` (deprecated)
The value to use for this option's destination if the option is not seen on the
command line. Deprecated; use ``parser.set_defaults()`` instead.
* ``nargs`` (default: 1)
* ``nargs`` (default: 1)
How many arguments of type :attr:`type` should be consumed when this option is
seen. If > 1, :mod:`optparse` will store a tuple of values to :attr:`dest`.
* ``const``
* ``const``
For actions that store a constant value, the constant value to store.
* ``choices``
* ``choices``
For options of type ``"choice"``, the list of strings the user may choose from.
* ``callback``
* ``callback``
For options with action ``"callback"``, the callable to call when this option is
seen. See section :ref:`optparse-option-callbacks`, Option Callbacks for detail
on the arguments passed to ``callable``.
* ``callback_args``, ``callback_kwargs``
* ``callback_args``, ``callback_kwargs``
Additional positional and keyword arguments to pass to ``callback`` after the
four standard callback arguments.
* :attr:`help`
* :attr:`help`
Help text to print for this option when listing all available options after the
user supplies a :attr:`help` option (such as ``"--help"``). If no help text is
supplied, the option will be listed without help text. To hide this option, use
the special value ``SUPPRESS_HELP``.
* ``metavar`` (default: derived from option strings)
* ``metavar`` (default: derived from option strings)
Stand-in for the option argument(s) to use when printing help text. See section
:ref:`optparse-tutorial`, the tutorial for an example.
@ -1119,13 +1119,13 @@ the command line is stored in the destination (or passed to the callback) as-is.
Integer arguments (type ``int`` or ``long``) are parsed as follows:
* if the number starts with ``0x``, it is parsed as a hexadecimal number
* if the number starts with ``0x``, it is parsed as a hexadecimal number
* if the number starts with ``0``, it is parsed as an octal number
* if the number starts with ``0``, it is parsed as an octal number
* if the number starts with ``0b``, is is parsed as a binary number
* if the number starts with ``0b``, is is parsed as a binary number
* otherwise, the number is parsed as a decimal number
* otherwise, the number is parsed as a decimal number
The conversion is done by calling either ``int()`` or ``long()`` with the
@ -1290,13 +1290,13 @@ Other methods
OptionParser supports several other public methods:
* ``set_usage(usage)``
* ``set_usage(usage)``
Set the usage string according to the rules described above for the ``usage``
constructor keyword argument. Passing ``None`` sets the default usage string;
use ``SUPPRESS_USAGE`` to suppress a usage message.
* ``enable_interspersed_args()``, ``disable_interspersed_args()``
* ``enable_interspersed_args()``, ``disable_interspersed_args()``
Enable/disable positional arguments interspersed with options, similar to GNU
getopt (enabled by default). For example, if ``"-a"`` and ``"-b"`` are both
@ -1313,7 +1313,7 @@ OptionParser supports several other public methods:
traditional Unix syntax, where option parsing stops with the first non-option
argument.
* ``set_defaults(dest=value, ...)``
* ``set_defaults(dest=value, ...)``
Set default values for several option destinations at once. Using
:meth:`set_defaults` is the preferred way to set default values for options,
@ -1351,9 +1351,9 @@ cases. Quite often a simple callback is all you need.
There are two steps to defining a callback option:
* define the option itself using the ``callback`` action
* define the option itself using the ``callback`` action
* write the callback; this is a function (or method) that takes at least four
* write the callback; this is a function (or method) that takes at least four
arguments, as described below
@ -1586,12 +1586,12 @@ conventional Unix command-line parsing that :mod:`optparse` normally handles for
you. In particular, callbacks should implement the conventional rules for bare
``"--"`` and ``"-"`` arguments:
* either ``"--"`` or ``"-"`` can be option arguments
* either ``"--"`` or ``"-"`` can be option arguments
* bare ``"--"`` (if not the argument to some option): halt command-line
* bare ``"--"`` (if not the argument to some option): halt command-line
processing and discard the ``"--"``
* bare ``"-"`` (if not the argument to some option): halt command-line
* bare ``"-"`` (if not the argument to some option): halt command-line
processing but keep the ``"-"`` (append it to ``parser.largs``)
If you want an option that takes a variable number of arguments, there are
@ -1799,18 +1799,18 @@ Again we define a subclass of Option::
Features of note:
* ``extend`` both expects a value on the command-line and stores that value
* ``extend`` both expects a value on the command-line and stores that value
somewhere, so it goes in both :attr:`STORE_ACTIONS` and :attr:`TYPED_ACTIONS`
* to ensure that :mod:`optparse` assigns the default type of ``string`` to
* to ensure that :mod:`optparse` assigns the default type of ``string`` to
``extend`` actions, we put the ``extend`` action in ``ALWAYS_TYPED_ACTIONS`` as
well
* :meth:`MyOption.take_action` implements just this one new action, and passes
* :meth:`MyOption.take_action` implements just this one new action, and passes
control back to :meth:`Option.take_action` for the standard :mod:`optparse`
actions
* ``values`` is an instance of the optparse_parser.Values class, which
* ``values`` is an instance of the optparse_parser.Values class, which
provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` is
essentially :func:`getattr` with a safety valve; it is called as ::

View File

@ -766,10 +766,10 @@ func
are commonly known as *callbacks*.)
add
is optional, either ```` or``\ +``. Passing an empty string denotes that this
binding is to replace any other bindings that this event is associated with.
Preceeding with a``\ +`` means that this function is to be added to the list of
functions bound to this event type.
is optional, either ``''`` or ``'+'``. Passing an empty string denotes that
this binding is to replace any other bindings that this event is associated
with. Passing a ``'+'`` means that this function is to be added to the list
of functions bound to this event type.
For example::

View File

@ -62,10 +62,10 @@ The :mod:`urllib2` module defines the following functions:
.. function:: build_opener([handler, ...])
Return an :class:`OpenerDirector` instance, which chains the handlers in the
order given. *handler*s can be either instances of :class:`BaseHandler`, or
order given. *handler*\s can be either instances of :class:`BaseHandler`, or
subclasses of :class:`BaseHandler` (in which case it must be possible to call
the constructor without any parameters). Instances of the following classes
will be in front of the *handler*s, unless the *handler*s contain them,
will be in front of the *handler*\s, unless the *handler*\s contain them,
instances of them or subclasses of them: :class:`ProxyHandler`,
:class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`,
:class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`,

View File

@ -1,6 +1,5 @@
:mod:`xml.etree` --- The ElementTree API for XML
=================================================
:mod:`xml.etree` --- The ElementTree API for XML
================================================
.. module:: xml.etree
:synopsis: Package containing common ElementTree modules.

View File

@ -77,7 +77,7 @@ The :mod:`EasyDialogs` module defines the following functions:
options are selected. Its items can take one of two forms: *optstr* or
``(optstr, descr)``. When present, *descr* is a short descriptive string that
is displayed in the dialog while this option is selected in the popup menu. The
correspondence between *optstr*s and command-line arguments is:
correspondence between *optstr*\s and command-line arguments is:
+----------------------+------------------------------------------+
| *optstr* format | Command-line format |

View File

@ -86,12 +86,7 @@ following modules are relevant to MacPython AppleScript support:
aepack.rst
aetypes.rst
miniae.rst
In addition, support modules have been pre-generated for :mod:`Finder`,
:mod:`Terminal`, :mod:`Explorer`, :mod:`Netscape`, :mod:`CodeWarrior`,
:mod:`SystemEvents` and :mod:`StdSuites`.
XXX: input{libgensuitemodule} :XXX
XXX: input{libaetools} :XXX
XXX: input{libaepack} :XXX
XXX: input{libaetypes} :XXX
XXX: input{libminiae} :XXX

View File

@ -416,7 +416,6 @@ def token_xrefs(text, env):
pos = m.end()
if pos < len(text):
retnodes.append(nodes.Text(text[pos:], text[pos:]))
print retnodes
return retnodes
def productionlist_directive(name, arguments, options, content, lineno,