Remove redundant section titles after :ref:s.

This commit is contained in:
Georg Brandl
2007-08-02 14:49:09 +00:00
parent 3d3c60d42c
commit 549719761d
69 changed files with 390 additions and 435 deletions

View File

@@ -1721,9 +1721,8 @@ returning data from the target object.
.. index:: single: PyBufferProcs .. index:: single: PyBufferProcs
More information on the buffer interface is provided in the section "Buffer More information on the buffer interface is provided in the section
Object Structures" (section :ref:`buffer-structs`), under the description for :ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`.
:ctype:`PyBufferProcs`.
A "buffer object" is defined in the :file:`bufferobject.h` header (included by A "buffer object" is defined in the :file:`bufferobject.h` header (included by
:file:`Python.h`). These objects look very similar to string objects at the :file:`Python.h`). These objects look very similar to string objects at the

View File

@@ -701,8 +701,8 @@ XXX
.. cmember:: PyBufferProcs* PyTypeObject.tp_as_buffer .. cmember:: PyBufferProcs* PyTypeObject.tp_as_buffer
Pointer to an additional structure that contains fields relevant only to objects Pointer to an additional structure that contains fields relevant only to objects
which implement the buffer interface. These fields are documented in "Buffer which implement the buffer interface. These fields are documented in
Object Structures" (section :ref:`buffer-structs`). :ref:`buffer-structs`.
The :attr:`tp_as_buffer` field is not inherited, but the contained fields are The :attr:`tp_as_buffer` field is not inherited, but the contained fields are
inherited individually. inherited individually.

View File

@@ -457,15 +457,14 @@ be part of a module definition::
} }
This function must be registered with the interpreter using the This function must be registered with the interpreter using the
:const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`, :const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The
"The Module's Method Table and Initialization Function." The
:cfunc:`PyArg_ParseTuple` function and its arguments are documented in section :cfunc:`PyArg_ParseTuple` function and its arguments are documented in section
:ref:`parsetuple`, "Extracting Parameters in Extension Functions." :ref:`parsetuple`.
The macros :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` increment/decrement the The macros :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` increment/decrement the
reference count of an object and are safe in the presence of *NULL* pointers reference count of an object and are safe in the presence of *NULL* pointers
(but note that *temp* will not be *NULL* in this context). More info on them (but note that *temp* will not be *NULL* in this context). More info on them
in section :ref:`refcounts`, "Reference Counts." in section :ref:`refcounts`.
.. index:: single: PyEval_CallObject() .. index:: single: PyEval_CallObject()

View File

@@ -42,7 +42,7 @@ XXX: input{boilerplate} :XXX
.. % end{latexonly} .. % end{latexonly}
.. _intro: .. _inst-intro:
Introduction Introduction
============ ============
@@ -67,7 +67,7 @@ on how to distribute your own Python modules so that others may use them, see
the Distributing Python Modules (XXX reference: ../dist/dist.html) manual. the Distributing Python Modules (XXX reference: ../dist/dist.html) manual.
.. _trivial-install: .. _inst-trivial-install:
Best case: trivial installation Best case: trivial installation
------------------------------- -------------------------------
@@ -95,7 +95,7 @@ standard way. The bulk of this document is about building and installing
modules from standard source distributions. modules from standard source distributions.
.. _new-standard: .. _inst-new-standard:
The new standard: Distutils The new standard: Distutils
--------------------------- ---------------------------
@@ -119,12 +119,12 @@ really need this manual. Or rather, the above command is everything you need to
get out of this manual. get out of this manual.
.. _standard-install: .. _inst-standard-install:
Standard Build and Install Standard Build and Install
========================== ==========================
As described in section :ref:`new-standard`, building and installing a module As described in section :ref:`inst-new-standard`, building and installing a module
distribution using the Distutils is usually one simple command:: distribution using the Distutils is usually one simple command::
python setup.py install python setup.py install
@@ -134,7 +134,7 @@ open a command prompt window ("DOS box") and do it there; on Mac OS X, you open
a :command:`Terminal` window to get a shell prompt. a :command:`Terminal` window to get a shell prompt.
.. _platform-variations: .. _inst-platform-variations:
Platform variations Platform variations
------------------- -------------------
@@ -159,7 +159,7 @@ command prompt window ("DOS box"), and run::
python setup.py install python setup.py install
.. _splitting-up: .. _inst-splitting-up:
Splitting the job up Splitting the job up
-------------------- --------------------
@@ -189,7 +189,7 @@ tasks. If you get into distributing your own Python modules and extensions,
you'll run lots of individual Distutils commands on their own. you'll run lots of individual Distutils commands on their own.
.. _how-build-works: .. _inst-how-build-works:
How building works How building works
------------------ ------------------
@@ -203,7 +203,7 @@ to keep the source tree pristine, you can change the build directory with the
python setup.py build --build-base=/tmp/pybuild/foo-1.0 python setup.py build --build-base=/tmp/pybuild/foo-1.0
(Or you could do this permanently with a directive in your system or personal (Or you could do this permanently with a directive in your system or personal
Distutils configuration file; see section :ref:`config-files`.) Normally, this Distutils configuration file; see section :ref:`inst-config-files`.) Normally, this
isn't necessary. isn't necessary.
The default layout for the build tree is as follows:: The default layout for the build tree is as follows::
@@ -228,7 +228,7 @@ documentation, binary executables, and whatever else is needed to handle the job
of installing Python modules and applications. of installing Python modules and applications.
.. _how-install-works: .. _inst-how-install-works:
How installation works How installation works
---------------------- ----------------------
@@ -290,12 +290,12 @@ statements shown below, and get the output as shown, to find out my
If you don't want to install modules to the standard location, or if you don't If you don't want to install modules to the standard location, or if you don't
have permission to write there, then you need to read about alternate have permission to write there, then you need to read about alternate
installations in section :ref:`alt-install`. If you want to customize your installations in section :ref:`inst-alt-install`. If you want to customize your
installation directories more heavily, see section :ref:`custom-install` on installation directories more heavily, see section :ref:`inst-custom-install` on
custom installations. custom installations.
.. _alt-install: .. _inst-alt-install:
Alternate Installation Alternate Installation
====================== ======================
@@ -317,7 +317,7 @@ differ across platforms, so read whichever of the following sections applies to
you. you.
.. _alt-install-prefix: .. _inst-alt-install-prefix:
Alternate installation: the home scheme Alternate installation: the home scheme
--------------------------------------- ---------------------------------------
@@ -358,7 +358,7 @@ installed to the following directories under the installation base as follows:
The :option:`--home` option used to be supported only on Unix. The :option:`--home` option used to be supported only on Unix.
.. _alt-install-home: .. _inst-alt-install-home:
Alternate installation: Unix (the prefix scheme) Alternate installation: Unix (the prefix scheme)
------------------------------------------------ ------------------------------------------------
@@ -430,7 +430,7 @@ if your :option:`--prefix` and :option:`--exec-prefix` don't even point to an
alternate Python installation, this is immaterial.) alternate Python installation, this is immaterial.)
.. _alt-install-windows: .. _inst-alt-install-windows:
Alternate installation: Windows (the prefix scheme) Alternate installation: Windows (the prefix scheme)
--------------------------------------------------- ---------------------------------------------------
@@ -461,13 +461,13 @@ installed as follows:
+------------------------------+---------------------------+-----------------------------+ +------------------------------+---------------------------+-----------------------------+
.. _custom-install: .. _inst-custom-install:
Custom Installation Custom Installation
=================== ===================
Sometimes, the alternate installation schemes described in section Sometimes, the alternate installation schemes described in section
:ref:`alt-install` just don't do what you want. You might want to tweak just :ref:`inst-alt-install` just don't do what you want. You might want to tweak just
one or two directories while keeping everything under the same base directory, one or two directories while keeping everything under the same base directory,
or you might want to completely redefine the installation scheme. In either or you might want to completely redefine the installation scheme. In either
case, you're creating a *custom installation scheme*. case, you're creating a *custom installation scheme*.
@@ -513,7 +513,7 @@ For example::
The specified installation directories are relative to :file:`{prefix}`. Of The specified installation directories are relative to :file:`{prefix}`. Of
course, you also have to ensure that these directories are in Python's module course, you also have to ensure that these directories are in Python's module
search path, such as by putting a :file:`.pth` file in :file:`{prefix}`. See search path, such as by putting a :file:`.pth` file in :file:`{prefix}`. See
section :ref:`search-path` to find out how to modify Python's search path. section :ref:`inst-search-path` to find out how to modify Python's search path.
If you want to define an entire installation scheme, you just have to supply all If you want to define an entire installation scheme, you just have to supply all
of the installation directory options. The recommended way to do this is to of the installation directory options. The recommended way to do this is to
@@ -548,7 +548,7 @@ parsing your configuration file(s).
Obviously, specifying the entire installation scheme every time you install a Obviously, specifying the entire installation scheme every time you install a
new module distribution would be very tedious. Thus, you can put these options new module distribution would be very tedious. Thus, you can put these options
into your Distutils config file (see section :ref:`config-files`):: into your Distutils config file (see section :ref:`inst-config-files`)::
[install] [install]
install-base=$HOME install-base=$HOME
@@ -582,7 +582,7 @@ environment variables in config files on platforms that have such a notion but
the Distutils additionally define a few extra variables that may not be in your the Distutils additionally define a few extra variables that may not be in your
environment, such as ``$PLAT``. (And of course, on systems that don't have environment, such as ``$PLAT``. (And of course, on systems that don't have
environment variables, such as Mac OS 9, the configuration variables supplied by environment variables, such as Mac OS 9, the configuration variables supplied by
the Distutils are the only ones you can use.) See section :ref:`config-files` the Distutils are the only ones you can use.) See section :ref:`inst-config-files`
for details. for details.
.. % XXX need some Windows examples---when would custom .. % XXX need some Windows examples---when would custom
@@ -591,7 +591,7 @@ for details.
.. % XXX I'm not sure where this section should go. .. % XXX I'm not sure where this section should go.
.. _search-path: .. _inst-search-path:
Modifying Python's Search Path Modifying Python's Search Path
------------------------------ ------------------------------
@@ -670,7 +670,7 @@ Finally, ``sys.path`` is just a regular Python list, so any Python application
can modify it by adding or removing entries. can modify it by adding or removing entries.
.. _config-files: .. _inst-config-files:
Distutils Configuration Files Distutils Configuration Files
============================= =============================
@@ -685,7 +685,7 @@ multiple configuration files apply, values from "earlier" files are overridden
by "later" files. by "later" files.
.. _config-filenames: .. _inst-config-filenames:
Location and names of config files Location and names of config files
---------------------------------- ----------------------------------
@@ -748,7 +748,7 @@ Notes:
Distutils make no attempt to guess your home directory on Windows.) Distutils make no attempt to guess your home directory on Windows.)
.. _config-syntax: .. _inst-config-syntax:
Syntax of config files Syntax of config files
---------------------- ----------------------
@@ -802,7 +802,7 @@ and you can find out the complete list of global options by using
See also the "Reference" section of the "Distributing Python Modules" manual. See also the "Reference" section of the "Distributing Python Modules" manual.
.. _building-ext: .. _inst-building-ext:
Building Extensions: Tips and Tricks Building Extensions: Tips and Tricks
==================================== ====================================
@@ -815,7 +815,7 @@ complicated situations this might be inappropriate. This section discusses how
to override the usual Distutils behaviour. to override the usual Distutils behaviour.
.. _tweak-flags: .. _inst-tweak-flags:
Tweaking compiler/linker flags Tweaking compiler/linker flags
------------------------------ ------------------------------
@@ -885,7 +885,7 @@ environment variable. If set, the contents of :envvar:`CFLAGS` will be added to
the compiler flags specified in the :file:`Setup` file. the compiler flags specified in the :file:`Setup` file.
.. _non-ms-compilers: .. _inst-non-ms-compilers:
Using non-Microsoft compilers on Windows Using non-Microsoft compilers on Windows
---------------------------------------- ----------------------------------------
@@ -932,7 +932,7 @@ To let Distutils compile your extension with Borland C++ you now have to type::
If you want to use the Borland C++ compiler as the default, you could specify If you want to use the Borland C++ compiler as the default, you could specify
this in your personal or system-wide configuration file for Distutils (see this in your personal or system-wide configuration file for Distutils (see
section :ref:`config-files`.) section :ref:`inst-config-files`.)
.. seealso:: .. seealso::
@@ -998,7 +998,7 @@ and for Cygwin in no-cygwin mode [#]_ or for MinGW type::
If you want to use any of these options/compilers as default, you should If you want to use any of these options/compilers as default, you should
consider to write it in your personal or system-wide configuration file for consider to write it in your personal or system-wide configuration file for
Distutils (see section :ref:`config-files`.) Distutils (see section :ref:`inst-config-files`.)
.. seealso:: .. seealso::

View File

@@ -8,7 +8,7 @@
This module provides direct access to all 'built-in' identifiers of Python; for This module provides direct access to all 'built-in' identifiers of Python; for
example, ``__builtin__.open`` is the full name for the built-in function example, ``__builtin__.open`` is the full name for the built-in function
:func:`open`. See chapter :ref:`builtin`, "Built-in Objects." :func:`open`. See chapter :ref:`builtin`.
This module is not normally accessed explicitly by most applications, but can be This module is not normally accessed explicitly by most applications, but can be
useful in modules that provide objects with the same name as a built-in value, useful in modules that provide objects with the same name as a built-in value,

View File

@@ -72,7 +72,7 @@ The :mod:`csv` module defines the following functions:
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparam* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`, "Dialects and Formatting Parameters". section :ref:`csv-fmt-params`.
All data read are returned as strings. No automatic data type conversion is All data read are returned as strings. No automatic data type conversion is
performed. performed.
@@ -99,7 +99,7 @@ The :mod:`csv` module defines the following functions:
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparam* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`, "Dialects and Formatting Parameters". To make it section :ref:`csv-fmt-params`. To make it
as easy as possible to interface with modules which implement the DB API, the as easy as possible to interface with modules which implement the DB API, the
value :const:`None` is written as the empty string. While this isn't a value :const:`None` is written as the empty string. While this isn't a
reversible transformation, it makes it easier to dump SQL NULL data values to reversible transformation, it makes it easier to dump SQL NULL data values to
@@ -113,8 +113,7 @@ The :mod:`csv` module defines the following functions:
dialect can be specified either by passing a sub-class of :class:`Dialect`, or dialect can be specified either by passing a sub-class of :class:`Dialect`, or
by *fmtparam* keyword arguments, or both, with keyword arguments overriding by *fmtparam* keyword arguments, or both, with keyword arguments overriding
parameters of the dialect. For full details about the dialect and formatting parameters of the dialect. For full details about the dialect and formatting
parameters, see section :ref:`csv-fmt-params`, "Dialects and Formatting parameters, see section :ref:`csv-fmt-params`.
Parameters".
.. function:: unregister_dialect(name) .. function:: unregister_dialect(name)

View File

@@ -2359,6 +2359,6 @@ with the same name, or create new attributes for names not present in
Arrays and pointers Arrays and pointers
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
Not yet written - please see section :ref:`ctypes-pointers`, pointers and Not yet written - please see the sections :ref:`ctypes-pointers` and
section :ref:`ctypes-arrays`, arrays in the tutorial. section :ref:`ctypes-arrays` in the tutorial.

View File

@@ -491,7 +491,7 @@ Instance methods:
Return a string representing the date, controlled by an explicit format string. Return a string representing the date, controlled by an explicit format string.
Format codes referring to hours, minutes or seconds will see 0 values. See Format codes referring to hours, minutes or seconds will see 0 values. See
section :ref:`strftime-behavior` -- :meth:`strftime` behavior. section :ref:`strftime-behavior`.
.. _datetime-datetime: .. _datetime-datetime:
@@ -931,7 +931,7 @@ Instance methods:
.. method:: datetime.strftime(format) .. method:: datetime.strftime(format)
Return a string representing the date and time, controlled by an explicit format Return a string representing the date and time, controlled by an explicit format
string. See section :ref:`strftime-behavior` -- :meth:`strftime` behavior. string. See section :ref:`strftime-behavior`.
.. _datetime-time: .. _datetime-time:
@@ -1056,7 +1056,7 @@ Instance methods:
.. method:: time.strftime(format) .. method:: time.strftime(format)
Return a string representing the time, controlled by an explicit format string. Return a string representing the time, controlled by an explicit format string.
See section :ref:`strftime-behavior` -- :meth:`strftime` behavior. See section :ref:`strftime-behavior`.
.. method:: time.utcoffset() .. method:: time.utcoffset()

View File

@@ -419,10 +419,9 @@ available. They are listed here in alphabetical order.
.. function:: file(filename[, mode[, bufsize]]) .. function:: file(filename[, mode[, bufsize]])
Constructor function for the :class:`file` type, described further in section Constructor function for the :class:`file` type, described further in section
:ref:`bltin-file-objects`, "File Objects (XXX reference: bltin-file- :ref:`bltin-file-objects`. The constructor's arguments are the same as those
objects.html)". The constructor's arguments are the same as those of the of the :func:`open` built-in function described below.
:func:`open` built-in function described below.
When opening a file, it's preferable to use :func:`open` instead of invoking When opening a file, it's preferable to use :func:`open` instead of invoking
this constructor directly. :class:`file` is more suited to type testing (for this constructor directly. :class:`file` is more suited to type testing (for
@@ -721,11 +720,10 @@ available. They are listed here in alphabetical order.
.. function:: open(filename[, mode[, bufsize]]) .. function:: open(filename[, mode[, bufsize]])
Open a file, returning an object of the :class:`file` type described in section Open a file, returning an object of the :class:`file` type described in
:ref:`bltin-file-objects`, "File Objects (XXX reference: bltin-file- section :ref:`bltin-file-objects`. If the file cannot be opened,
objects.html)". If the file cannot be opened, :exc:`IOError` is raised. When :exc:`IOError` is raised. When opening a file, it's preferable to use
opening a file, it's preferable to use :func:`open` instead of invoking the :func:`open` instead of invoking the :class:`file` constructor directly.
:class:`file` constructor directly.
The first two arguments are the same as for ``stdio``'s :cfunc:`fopen`: The first two arguments are the same as for ``stdio``'s :cfunc:`fopen`:
*filename* is the file name to be opened, and *mode* is a string indicating how *filename* is the file name to be opened, and *mode* is a string indicating how

View File

@@ -44,9 +44,8 @@ browse the table of contents (in front of the manual), or look for a specific
function, module or term in the index (in the back). And finally, if you enjoy function, module or term in the index (in the back). And finally, if you enjoy
learning about random subjects, you choose a random page number (see module learning about random subjects, you choose a random page number (see module
:mod:`random`) and read a section or two. Regardless of the order in which you :mod:`random`) and read a section or two. Regardless of the order in which you
read the sections of this manual, it helps to start with chapter read the sections of this manual, it helps to start with chapter :ref:`builtin`,
:ref:`builtin`, "Built-in Types, Exceptions and Functions," as the remainder of as the remainder of the manual assumes familiarity with this material.
the manual assumes familiarity with this material.
Let the show begin! Let the show begin!

View File

@@ -1483,8 +1483,8 @@ A Formatter can be initialized with a format string which makes use of knowledge
of the :class:`LogRecord` attributes - such as the default value mentioned above of the :class:`LogRecord` attributes - such as the default value mentioned above
making use of the fact that the user's message and arguments are pre-formatted making use of the fact that the user's message and arguments are pre-formatted
into a :class:`LogRecord`'s *message* attribute. This format string contains into a :class:`LogRecord`'s *message* attribute. This format string contains
standard python %-style mapping keys. See section :ref:`typesseq-strings`, standard python %-style mapping keys. See section :ref:`typesseq-strings`
"String Formatting Operations," for more information on string formatting. for more information on string formatting.
Currently, the useful mapping keys in a :class:`LogRecord` are: Currently, the useful mapping keys in a :class:`LogRecord` are:

View File

@@ -309,7 +309,7 @@ Understanding option actions
Actions tell :mod:`optparse` what to do when it encounters an option on the Actions tell :mod:`optparse` what to do when it encounters an option on the
command line. There is a fixed set of actions hard-coded into :mod:`optparse`; command line. There is a fixed set of actions hard-coded into :mod:`optparse`;
adding new actions is an advanced topic covered in section adding new actions is an advanced topic covered in section
:ref:`optparse-extending-optparse`, Extending :mod:`optparse`. Most actions tell :ref:`optparse-extending-optparse`. Most actions tell
:mod:`optparse` to store a value in some variable---for example, take a string :mod:`optparse` to store a value in some variable---for example, take a string
from the command line and store it in an attribute of ``options``. from the command line and store it in an attribute of ``options``.
@@ -369,8 +369,7 @@ long option strings, :mod:`optparse` looks at the first short option string: the
default destination for ``"-f"`` is ``f``. default destination for ``"-f"`` is ``f``.
:mod:`optparse` also includes built-in ``long`` and ``complex`` types. Adding :mod:`optparse` also includes built-in ``long`` and ``complex`` types. Adding
types is covered in section :ref:`optparse-extending-optparse`, Extending types is covered in section :ref:`optparse-extending-optparse`.
:mod:`optparse`.
.. _optparse-handling-boolean-options: .. _optparse-handling-boolean-options:
@@ -415,7 +414,7 @@ Some other actions supported by :mod:`optparse` are:
call a specified function call a specified function
These are covered in section :ref:`optparse-reference-guide`, Reference Guide These are covered in section :ref:`optparse-reference-guide`, Reference Guide
and section :ref:`optparse-option-callbacks`, Option Callbacks. and section :ref:`optparse-option-callbacks`.
.. _optparse-default-values: .. _optparse-default-values:
@@ -704,8 +703,7 @@ not rely on the order in which the arguments are declared.
``conflict_handler`` (default: ``"error"``) ``conflict_handler`` (default: ``"error"``)
Specifies what to do when options with conflicting option strings are added to Specifies what to do when options with conflicting option strings are added to
the parser; see section :ref:`optparse-conflicts-between-options`, Conflicts the parser; see section :ref:`optparse-conflicts-between-options`.
between options.
``description`` (default: ``None``) ``description`` (default: ``None``)
A paragraph of text giving a brief overview of your program. :mod:`optparse` A paragraph of text giving a brief overview of your program. :mod:`optparse`
@@ -734,8 +732,7 @@ Populating the parser
There are several ways to populate the parser with options. The preferred way There are several ways to populate the parser with options. The preferred way
is by using ``OptionParser.add_option()``, as shown in section is by using ``OptionParser.add_option()``, as shown in section
:ref:`optparse-tutorial`, the tutorial. :meth:`add_option` can be called in one :ref:`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:
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`)
@@ -986,7 +983,7 @@ must specify for any option using that action.
func(option, opt_str, value, parser, *args, **kwargs) func(option, opt_str, value, parser, *args, **kwargs)
See section :ref:`optparse-option-callbacks`, Option Callbacks for more detail. See section :ref:`optparse-option-callbacks` for more detail.
* :attr:`help` * :attr:`help`
@@ -1083,9 +1080,9 @@ to a particular option, or fail to pass a required option attribute,
* ``callback`` * ``callback``
For options with action ``"callback"``, the callable to call when this option is For options with action ``"callback"``, the callable to call when this option
seen. See section :ref:`optparse-option-callbacks`, Option Callbacks for detail is seen. See section :ref:`optparse-option-callbacks` for detail on the
on the arguments passed to ``callable``. arguments passed to ``callable``.
* ``callback_args``, ``callback_kwargs`` * ``callback_args``, ``callback_kwargs``
@@ -1102,7 +1099,7 @@ to a particular option, or fail to pass a required option attribute,
* ``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 Stand-in for the option argument(s) to use when printing help text. See section
:ref:`optparse-tutorial`, the tutorial for an example. :ref:`optparse-tutorial` for an example.
.. _optparse-standard-option-types: .. _optparse-standard-option-types:
@@ -1112,7 +1109,7 @@ Standard option types
:mod:`optparse` has six built-in option types: ``string``, ``int``, ``long``, :mod:`optparse` has six built-in option types: ``string``, ``int``, ``long``,
``choice``, ``float`` and ``complex``. If you need to add new option types, see ``choice``, ``float`` and ``complex``. If you need to add new option types, see
section :ref:`optparse-extending-optparse`, Extending :mod:`optparse`. section :ref:`optparse-extending-optparse`.
Arguments to string options are not checked or converted in any way: the text on Arguments to string options are not checked or converted in any way: the text on
the command line is stored in the destination (or passed to the callback) as-is. the command line is stored in the destination (or passed to the callback) as-is.

View File

@@ -122,8 +122,7 @@ process and user.
getcwd() getcwd()
:noindex: :noindex:
These functions are described in "Files and Directories" (section These functions are described in :ref:`os-file-dir`.
:ref:`os-file-dir`).
.. function:: ctermid() .. function:: ctermid()
@@ -422,8 +421,7 @@ retrieve the return codes is to use the :mod:`subprocess` module; these are only
available on Unix. available on Unix.
For a discussion of possible deadlock conditions related to the use of these For a discussion of possible deadlock conditions related to the use of these
functions, see "Flow Control Issues (XXX reference: popen2-flow-control.html)" functions, see :ref:`popen2-flow-control`.
(section :ref:`popen2-flow-control`).
.. function:: popen2(cmd[, mode[, bufsize]]) .. function:: popen2(cmd[, mode[, bufsize]])

View File

@@ -39,8 +39,7 @@ This module provides one exception and one type object:
.. exception:: ExpatError .. exception:: ExpatError
The exception raised when Expat reports an error. See section The exception raised when Expat reports an error. See section
:ref:`expaterror-objects`, "ExpatError Exceptions," for more information on :ref:`expaterror-objects` for more information on interpreting Expat errors.
interpreting Expat errors.
.. exception:: error .. exception:: error

View File

@@ -58,7 +58,7 @@ The :mod:`shlex` module defines the following class:
was introduced in Python 2.3, and defines the operational mode. When *posix* is was introduced in Python 2.3, and defines the operational mode. When *posix* is
not true (default), the :class:`shlex` instance will operate in compatibility not true (default), the :class:`shlex` instance will operate in compatibility
mode. When operating in POSIX mode, :class:`shlex` will try to be as close as mode. When operating in POSIX mode, :class:`shlex` will try to be as close as
possible to the POSIX shell parsing rules. See section :ref:`shlex-objects`. possible to the POSIX shell parsing rules.
.. seealso:: .. seealso::

View File

@@ -571,13 +571,12 @@ correspond to Unix system calls applicable to sockets.
.. index:: single: I/O control; buffering .. index:: single: I/O control; buffering
Return a :dfn:`file object` associated with the socket. (File objects are Return a :dfn:`file object` associated with the socket. (File objects are
described in :ref:`bltin-file-objects`, "File Objects.") The file object described in :ref:`bltin-file-objects`.) The file object
references a :cfunc:`dup`\ ped version of the socket file descriptor, so the references a :cfunc:`dup`\ ped version of the socket file descriptor, so the
file object and socket object may be closed or garbage-collected independently. file object and socket object may be closed or garbage-collected independently.
The socket must be in blocking mode (it can not have a timeout). The optional The socket must be in blocking mode (it can not have a timeout). The optional
*mode* and *bufsize* arguments are interpreted the same way as by the built-in *mode* and *bufsize* arguments are interpreted the same way as by the built-in
:func:`file` function; see "Built-in Functions" (section :ref:`built-in-funcs`) :func:`file` function; see :ref:`built-in-funcs` for more information.
for more information.
.. method:: socket.recv(bufsize[, flags]) .. method:: socket.recv(bufsize[, flags])

View File

@@ -227,8 +227,8 @@ A :class:`Connection` instance has the following attributes and methods:
.. attribute:: Connection.isolation_level .. attribute:: Connection.isolation_level
Get or set the current isolation level. None for autocommit mode or one of Get or set the current isolation level. None for autocommit mode or one of
"DEFERRED", "IMMEDIATE" or "EXLUSIVE". See "Controlling Transactions", section "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section
:ref:`sqlite3-controlling-transactions`, for a more detailed explanation. :ref:`sqlite3-controlling-transactions` for a more detailed explanation.
.. method:: Connection.cursor([cursorClass]) .. method:: Connection.cursor([cursorClass])
@@ -629,9 +629,8 @@ the database is actually a point. There are two ways of doing this:
* Explicitly via the column name * Explicitly via the column name
Both ways are described in "Module Constants", section Both ways are described in section :ref:`sqlite3-module-contents`, in the entries
:ref:`sqlite3-module-contents`, in the entries for the constants for the constants :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES`.
:const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES`.
The following example illustrates both approaches. The following example illustrates both approaches.

View File

@@ -341,7 +341,7 @@ Notes:
for well-defined conversions. for well-defined conversions.
(3) (3)
See section :ref:`built-in-funcs`, "Built-in Functions," for a full description. See :ref:`built-in-funcs` for a full description.
(4) (4)
Complex floor division operator, modulo operator, and :func:`divmod`. Complex floor division operator, modulo operator, and :func:`divmod`.
@@ -1739,9 +1739,9 @@ File Objects
File objects are implemented using C's ``stdio`` package and can be created with File objects are implemented using C's ``stdio`` package and can be created with
the built-in constructor :func:`file` described in section the built-in constructor :func:`file` described in section
:ref:`built-in-funcs`, "Built-in Functions." [#]_ File objects are also :ref:`built-in-funcs`. [#]_ File objects are also returned by some other
returned by some other built-in functions and methods, such as :func:`os.popen` built-in functions and methods, such as :func:`os.popen` and :func:`os.fdopen`
and :func:`os.fdopen` and the :meth:`makefile` method of socket objects. and the :meth:`makefile` method of socket objects.
When a file operation fails for an I/O-related reason, the exception When a file operation fails for an I/O-related reason, the exception
:exc:`IOError` is raised. This includes situations where the operation is not :exc:`IOError` is raised. This includes situations where the operation is not
@@ -2366,4 +2366,3 @@ types, where they are relevant. Some of these are not reported by the
might matter, for example, if you want to make an exact copy of a file while might matter, for example, if you want to make an exact copy of a file while
scanning its lines) to tell whether the last line of a file ended in a newline scanning its lines) to tell whether the last line of a file ended in a newline
or not (yes this happens!). or not (yes this happens!).

View File

@@ -245,10 +245,9 @@ Deprecated string functions
--------------------------- ---------------------------
The following list of functions are also defined as methods of string and The following list of functions are also defined as methods of string and
Unicode objects; see "String Methods" (section :ref:`string-methods`) for more Unicode objects; see section :ref:`string-methods` for more information on
information on those. You should consider these functions as deprecated, those. You should consider these functions as deprecated, although they will
although they will not be removed until Python 3.0. The functions defined in not be removed until Python 3.0. The functions defined in this module are:
this module are:
.. function:: atof(s) .. function:: atof(s)

View File

@@ -365,7 +365,7 @@ always available.
Their intended use is to allow an interactive user to import a debugger module Their intended use is to allow an interactive user to import a debugger module
and engage in post-mortem debugging without having to re-execute the command and engage in post-mortem debugging without having to re-execute the command
that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the
post-mortem debugger; see chapter :ref:`debugger`, "The Python Debugger," for post-mortem debugger; see chapter :ref:`debugger` for
more information.) more information.)
The meaning of the variables is the same as that of the return values from The meaning of the variables is the same as that of the return values from
@@ -528,9 +528,9 @@ always available.
single: trace function single: trace function
single: debugger single: debugger
Set the system's trace function, which allows you to implement a Python source Set the system's trace function, which allows you to implement a Python
code debugger in Python. See section :ref:`debugger-hooks`, "How It Works," in source code debugger in Python. See section :ref:`debugger-hooks` in the
the chapter on the Python debugger. The function is thread-specific; for a chapter on the Python debugger. The function is thread-specific; for a
debugger to support multiple threads, it must be registered using debugger to support multiple threads, it must be registered using
:func:`settrace` for each thread being debugged. :func:`settrace` for each thread being debugged.

View File

@@ -37,7 +37,7 @@ Some facts and figures:
Return a :class:`TarFile` object for the pathname *name*. For detailed Return a :class:`TarFile` object for the pathname *name*. For detailed
information on :class:`TarFile` objects and the keyword arguments that are information on :class:`TarFile` objects and the keyword arguments that are
allowed, see TarFile Objects (section :ref:`tarfile-objects`). allowed, see :ref:`tarfile-objects`.
*mode* has to be a string of the form ``'filemode[:compression]'``, it defaults *mode* has to be a string of the form ``'filemode[:compression]'``, it defaults
to ``'r'``. Here is a full list of mode combinations: to ``'r'``. Here is a full list of mode combinations:
@@ -75,14 +75,14 @@ Some facts and figures:
For special purposes, there is a second format for *mode*: For special purposes, there is a second format for *mode*:
``'filemode|[compression]'``. :func:`open` will return a :class:`TarFile` ``'filemode|[compression]'``. :func:`open` will return a :class:`TarFile`
object that processes its data as a stream of blocks. No random seeking will be object that processes its data as a stream of blocks. No random seeking will
done on the file. If given, *fileobj* may be any object that has a :meth:`read` be done on the file. If given, *fileobj* may be any object that has a
or :meth:`write` method (depending on the *mode*). *bufsize* specifies the :meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize*
blocksize and defaults to ``20 * 512`` bytes. Use this variant in combination specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant
with e.g. ``sys.stdin``, a socket file object or a tape device. However, such a in combination with e.g. ``sys.stdin``, a socket file object or a tape
:class:`TarFile` object is limited in that it does not allow to be accessed device. However, such a :class:`TarFile` object is limited in that it does
randomly, see "Examples" (section :ref:`tar-examples`). The currently possible not allow to be accessed randomly, see :ref:`tar-examples`. The currently
modes: possible modes:
+-------------+--------------------------------------------+ +-------------+--------------------------------------------+
| Mode | Action | | Mode | Action |
@@ -112,8 +112,7 @@ Some facts and figures:
.. class:: TarFile .. class:: TarFile
Class for reading and writing tar archives. Do not use this class directly, Class for reading and writing tar archives. Do not use this class directly,
better use :func:`open` instead. See "TarFile Objects" (section better use :func:`open` instead. See :ref:`tarfile-objects`.
:ref:`tarfile-objects`).
.. function:: is_tarfile(name) .. function:: is_tarfile(name)
@@ -221,7 +220,7 @@ The :class:`TarFile` object provides an interface to a tar archive. A tar
archive is a sequence of blocks. An archive member (a stored file) is made up of archive is a sequence of blocks. An archive member (a stored file) is made up of
a header block followed by data blocks. It is possible to store a file in a tar a header block followed by data blocks. It is possible to store a file in a tar
archive several times. Each archive member is represented by a :class:`TarInfo` archive several times. Each archive member is represented by a :class:`TarInfo`
object, see TarInfo Objects (section :ref:`tarinfo-objects`) for details. object, see :ref:`tarinfo-objects` for details.
.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=None, errors=None, pax_headers=None, debug=0, errorlevel=0) .. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=None, errors=None, pax_headers=None, debug=0, errorlevel=0)

View File

@@ -22,9 +22,8 @@ consult the Tk documentation, and occasionally the Tcl documentation.
classes. In addition, the internal module :mod:`_tkinter` provides a threadsafe classes. In addition, the internal module :mod:`_tkinter` provides a threadsafe
mechanism which allows Python and Tcl to interact. mechanism which allows Python and Tcl to interact.
Tk is not the only GUI for Python; see section :ref:`other-gui-packages`, "Other Tk is not the only GUI for Python; see section :ref:`other-gui-packages` for
User Interface Modules and Packages," for more information on other GUI toolkits more information on other GUI toolkits for Python.
for Python.
.. % Other sections I have in mind are .. % Other sections I have in mind are
.. % Tkinter internals .. % Tkinter internals

View File

@@ -90,8 +90,8 @@ The :mod:`urlparse` module defines the following functions:
| | | if present | | | | | if present | |
+------------------+-------+--------------------------+----------------------+ +------------------+-------+--------------------------+----------------------+
See section :ref:`urlparse-result-object`, "Results of :func:`urlparse` and See section :ref:`urlparse-result-object` for more information on the result
:func:`urlsplit`," for more information on the result object. object.
.. versionchanged:: 2.5 .. versionchanged:: 2.5
Added attributes to return value. Added attributes to return value.
@@ -141,8 +141,8 @@ The :mod:`urlparse` module defines the following functions:
| | | if present | | | | | if present | |
+------------------+-------+-------------------------+----------------------+ +------------------+-------+-------------------------+----------------------+
See section :ref:`urlparse-result-object`, "Results of :func:`urlparse` and See section :ref:`urlparse-result-object` for more information on the result
:func:`urlsplit`," for more information on the result object. object.
.. versionadded:: 2.2 .. versionadded:: 2.2

View File

@@ -177,8 +177,8 @@ The :mod:`UserString` module defines the following classes:
hard to track down. hard to track down.
In addition to supporting the methods and operations of string and Unicode In addition to supporting the methods and operations of string and Unicode
objects (see section :ref:`string-methods`, "String Methods"), objects (see section :ref:`string-methods`), :class:`UserString` instances
:class:`UserString` instances provide the following attribute: provide the following attribute:
.. attribute:: MutableString.data .. attribute:: MutableString.data

View File

@@ -65,8 +65,7 @@ The specification provided by the W3C defines the DOM API for Java, ECMAScript,
and OMG IDL. The Python mapping defined here is based in large part on the IDL and OMG IDL. The Python mapping defined here is based in large part on the IDL
version of the specification, but strict compliance is not required (though version of the specification, but strict compliance is not required (though
implementations are free to support the strict mapping from IDL). See section implementations are free to support the strict mapping from IDL). See section
:ref:`dom-conformance`, "Conformance," for a detailed discussion of mapping :ref:`dom-conformance` for a detailed discussion of mapping requirements.
requirements.
.. seealso:: .. seealso::
@@ -173,40 +172,40 @@ Note that DOM attributes may also be manipulated as nodes instead of as simple
strings. It is fairly rare that you must do this, however, so this usage is not strings. It is fairly rare that you must do this, however, so this usage is not
yet documented. yet documented.
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| Interface | Section | Purpose | | Interface | Section | Purpose |
+================================+=================================+=================================+ +================================+===================================+=================================+
| :class:`DOMImplementation` | :ref:`dom-implementation- | Interface to the underlying | | :class:`DOMImplementation` | :ref:`dom-implementation-objects` | Interface to the underlying |
| | objects` | implementation. | | | | implementation. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Node` | :ref:`dom-node-objects` | Base interface for most objects | | :class:`Node` | :ref:`dom-node-objects` | Base interface for most objects |
| | | in a document. | | | | in a document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`NodeList` | :ref:`dom-nodelist-objects` | Interface for a sequence of | | :class:`NodeList` | :ref:`dom-nodelist-objects` | Interface for a sequence of |
| | | nodes. | | | | nodes. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`DocumentType` | :ref:`dom-documenttype-objects` | Information about the | | :class:`DocumentType` | :ref:`dom-documenttype-objects` | Information about the |
| | | declarations needed to process | | | | declarations needed to process |
| | | a document. | | | | a document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Document` | :ref:`dom-document-objects` | Object which represents an | | :class:`Document` | :ref:`dom-document-objects` | Object which represents an |
| | | entire document. | | | | entire document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Element` | :ref:`dom-element-objects` | Element nodes in the document | | :class:`Element` | :ref:`dom-element-objects` | Element nodes in the document |
| | | hierarchy. | | | | hierarchy. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Attr` | :ref:`dom-attr-objects` | Attribute value nodes on | | :class:`Attr` | :ref:`dom-attr-objects` | Attribute value nodes on |
| | | element nodes. | | | | element nodes. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Comment` | :ref:`dom-comment-objects` | Representation of comments in | | :class:`Comment` | :ref:`dom-comment-objects` | Representation of comments in |
| | | the source document. | | | | the source document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Text` | :ref:`dom-text-objects` | Nodes containing textual | | :class:`Text` | :ref:`dom-text-objects` | Nodes containing textual |
| | | content from the document. | | | | content from the document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`ProcessingInstruction` | :ref:`dom-pi-objects` | Processing instruction | | :class:`ProcessingInstruction` | :ref:`dom-pi-objects` | Processing instruction |
| | | representation. | | | | representation. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
An additional section describes the exceptions defined for working with the DOM An additional section describes the exceptions defined for working with the DOM
in Python. in Python.

View File

@@ -70,24 +70,23 @@ a new parser object.
.. class:: AttributesImpl(attrs) .. class:: AttributesImpl(attrs)
This is an implementation of the :class:`Attributes` interface (XXX reference: This is an implementation of the :class:`Attributes` interface (see section
attributes-objects.html) (see section :ref:`attributes-objects`). This is a :ref:`attributes-objects`). This is a dictionary-like object which
dictionary-like object which represents the element attributes in a represents the element attributes in a :meth:`startElement` call. In addition
:meth:`startElement` call. In addition to the most useful dictionary operations, to the most useful dictionary operations, it supports a number of other
it supports a number of other methods as described by the interface. Objects of methods as described by the interface. Objects of this class should be
this class should be instantiated by readers; *attrs* must be a dictionary-like instantiated by readers; *attrs* must be a dictionary-like object containing
object containing a mapping from attribute names to attribute values. a mapping from attribute names to attribute values.
.. class:: AttributesNSImpl(attrs, qnames) .. class:: AttributesNSImpl(attrs, qnames)
Namespace-aware variant of :class:`AttributesImpl`, which will be passed to Namespace-aware variant of :class:`AttributesImpl`, which will be passed to
:meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but
understands attribute names as two-tuples of *namespaceURI* and *localname*. In understands attribute names as two-tuples of *namespaceURI* and
addition, it provides a number of methods expecting qualified names as they *localname*. In addition, it provides a number of methods expecting qualified
appear in the original document. This class implements the names as they appear in the original document. This class implements the
:class:`AttributesNS` interface (XXX reference: attributes-ns-objects.html) (see :class:`AttributesNS` interface (see section :ref:`attributes-ns-objects`).
section :ref:`attributes-ns-objects`).
.. _xmlreader-objects: .. _xmlreader-objects:
@@ -359,9 +358,9 @@ including the methods :meth:`copy`, :meth:`get`, :meth:`has_key`, :meth:`items`,
The :class:`AttributesNS` Interface The :class:`AttributesNS` Interface
----------------------------------- -----------------------------------
This interface is a subtype of the :class:`Attributes` interface (XXX reference: This interface is a subtype of the :class:`Attributes` interface (see section
attributes-objects.html) (see section :ref:`attributes-objects`). All methods :ref:`attributes-objects`). All methods supported by that interface are also
supported by that interface are also available on :class:`AttributesNS` objects. available on :class:`AttributesNS` objects.
The following methods are also available: The following methods are also available:

View File

@@ -40,8 +40,8 @@ The available attributes of this module are:
.. class:: ZipFile .. class:: ZipFile
The class for reading and writing ZIP files. See "ZipFile Objects" (section The class for reading and writing ZIP files. See section
:ref:`zipfile-objects`) for constructor details. :ref:`zipfile-objects` for constructor details.
.. class:: PyZipFile .. class:: PyZipFile
@@ -51,14 +51,14 @@ The available attributes of this module are:
.. class:: ZipInfo([filename[, date_time]]) .. class:: ZipInfo([filename[, date_time]])
Class used to represent information about a member of an archive. Instances of Class used to represent information about a member of an archive. Instances
this class are returned by the :meth:`getinfo` and :meth:`infolist` methods of of this class are returned by the :meth:`getinfo` and :meth:`infolist`
:class:`ZipFile` objects. Most users of the :mod:`zipfile` module will not need methods of :class:`ZipFile` objects. Most users of the :mod:`zipfile` module
to create these, but only use those created by this module. *filename* should be will not need to create these, but only use those created by this
the full name of the archive member, and *date_time* should be a tuple module. *filename* should be the full name of the archive member, and
containing six fields which describe the time of the last modification to the *date_time* should be a tuple containing six fields which describe the time
file; the fields are described in section :ref:`zipinfo-objects`, "ZipInfo of the last modification to the file; the fields are described in section
Objects." :ref:`zipinfo-objects`.
.. function:: is_zipfile(filename) .. function:: is_zipfile(filename)

View File

@@ -44,8 +44,8 @@ The available attributes of this module are:
.. class:: zipimporter .. class:: zipimporter
The class for importing ZIP files. See "zipimporter Objects" (section The class for importing ZIP files. See section :ref:`zipimporter-objects`
:ref:`zipimporter-objects`) for constructor details. for constructor details.
.. seealso:: .. seealso::

View File

@@ -108,7 +108,7 @@ Finder is non-standard as the Finder does not read your :file:`.profile` or
/.MacOSX/environment.plist`. See Apple's Technical Document QA1067 for details. /.MacOSX/environment.plist`. See Apple's Technical Document QA1067 for details.
For more information on installation Python packages in MacPython, see section For more information on installation Python packages in MacPython, see section
:ref:`mac-package-manager`, "Installing Additional Python Packages." :ref:`mac-package-manager`.
.. _ide: .. _ide:

View File

@@ -442,7 +442,7 @@ Mappings
the same dictionary entry. the same dictionary entry.
Dictionaries are mutable; they can be created by the ``{...}`` notation (see Dictionaries are mutable; they can be created by the ``{...}`` notation (see
section :ref:`dict`, "Dictionary Displays"). section :ref:`dict`).
.. index:: .. index::
module: dbm module: dbm
@@ -462,7 +462,7 @@ Callable types
pair: function; argument pair: function; argument
These are the types to which the function call operation (see section These are the types to which the function call operation (see section
:ref:`calls`, "Calls") can be applied: :ref:`calls`) can be applied:
User-defined functions User-defined functions
.. index:: .. index::
@@ -470,9 +470,9 @@ Callable types
object: function object: function
object: user-defined function object: user-defined function
A user-defined function object is created by a function definition (see section A user-defined function object is created by a function definition (see
:ref:`function`, "Function definitions"). It should be called with an argument section :ref:`function`). It should be called with an argument list
list containing the same number of items as the function's formal parameter containing the same number of items as the function's formal parameter
list. list.
Special attributes: Special attributes:
@@ -649,7 +649,7 @@ Callable types
single: generator; iterator single: generator; iterator
A function or method which uses the :keyword:`yield` statement (see section A function or method which uses the :keyword:`yield` statement (see section
:ref:`yield`, "The :keyword:`yield` statement") is called a :dfn:`generator :ref:`yield`) is called a :dfn:`generator
function`. Such a function, when called, always returns an iterator object function`. Such a function, when called, always returns an iterator object
which can be used to execute the body of the function: calling the iterator's which can be used to execute the body of the function: calling the iterator's
:meth:`next` method will cause the function to execute until it provides a value :meth:`next` method will cause the function to execute until it provides a value
@@ -717,7 +717,7 @@ Modules
object: module object: module
Modules are imported by the :keyword:`import` statement (see section Modules are imported by the :keyword:`import` statement (see section
:ref:`import`, "The :keyword:`import` statement"). A module object has a :ref:`import`). A module object has a
namespace implemented by a dictionary object (this is the dictionary referenced namespace implemented by a dictionary object (this is the dictionary referenced
by the func_globals attribute of functions defined in the module). Attribute by the func_globals attribute of functions defined in the module). Attribute
references are translated to lookups in this dictionary, e.g., ``m.x`` is references are translated to lookups in this dictionary, e.g., ``m.x`` is
@@ -750,8 +750,8 @@ Modules
of the shared library file. of the shared library file.
Classes Classes
Class objects are created by class definitions (see section :ref:`class`, "Class Class objects are created by class definitions (see section :ref:`class`).
definitions"). A class has a namespace implemented by a dictionary object. Class A class has a namespace implemented by a dictionary object. Class
attribute references are translated to lookups in this dictionary, e.g., ``C.x`` attribute references are translated to lookups in this dictionary, e.g., ``C.x``
is translated to ``C.__dict__["x"]``. When the attribute name is not found is translated to ``C.__dict__["x"]``. When the attribute name is not found
there, the attribute search continues in the base classes. The search is depth- there, the attribute search continues in the base classes. The search is depth-
@@ -838,8 +838,7 @@ Class instances
object: mapping object: mapping
Class instances can pretend to be numbers, sequences, or mappings if they have Class instances can pretend to be numbers, sequences, or mappings if they have
methods with certain special names. See section :ref:`specialnames`, "Special methods with certain special names. See section :ref:`specialnames`.
method names."
.. index:: .. index::
single: __dict__ (instance attribute) single: __dict__ (instance attribute)
@@ -1008,7 +1007,7 @@ Internal types
unwinds the execution stack, at each unwound level a traceback object is unwinds the execution stack, at each unwound level a traceback object is
inserted in front of the current traceback. When an exception handler is inserted in front of the current traceback. When an exception handler is
entered, the stack trace is made available to the program. (See section entered, the stack trace is made available to the program. (See section
:ref:`try`, "The ``try`` statement.") It is accessible as ``sys.exc_traceback``, :ref:`try`.) It is accessible as ``sys.exc_traceback``,
and also as the third item of the tuple returned by ``sys.exc_info()``. The and also as the third item of the tuple returned by ``sys.exc_info()``. The
latter is the preferred interface, since it works correctly when the program is latter is the preferred interface, since it works correctly when the program is
using multiple threads. When the program contains no suitable handler, the stack using multiple threads. When the program contains no suitable handler, the stack

View File

@@ -1253,7 +1253,7 @@ precedence (least binding) to highest precedence (most binding). Operators in
the same box have the same precedence. Unless the syntax is explicitly given, the same box have the same precedence. Unless the syntax is explicitly given,
operators are binary. Operators in the same box group left to right (except for operators are binary. Operators in the same box group left to right (except for
comparisons, including tests, which all have the same precedence and chain from comparisons, including tests, which all have the same precedence and chain from
left to right --- see section :ref:`comparisons` -- and exponentiation, which left to right --- see section :ref:`comparisons` --- and exponentiation, which
groups from right to left). groups from right to left).
+-----------------------------------------------+-------------------------------------+ +-----------------------------------------------+-------------------------------------+

View File

@@ -386,8 +386,7 @@ characters:
Not imported by ``from module import *``. The special identifier ``_`` is used Not imported by ``from module import *``. The special identifier ``_`` is used
in the interactive interpreter to store the result of the last evaluation; it is in the interactive interpreter to store the result of the last evaluation; it is
stored in the :mod:`__builtin__` module. When not in interactive mode, ``_`` stored in the :mod:`__builtin__` module. When not in interactive mode, ``_``
has no special meaning and is not defined. See section :ref:`import`, "The has no special meaning and is not defined. See section :ref:`import`.
:keyword:`import` statement."
.. note:: .. note::
@@ -400,13 +399,13 @@ characters:
implementation (including the standard library); applications should not expect implementation (including the standard library); applications should not expect
to define additional names using this convention. The set of names of this to define additional names using this convention. The set of names of this
class defined by Python may be extended in future versions. See section class defined by Python may be extended in future versions. See section
:ref:`specialnames`, "Special method names." :ref:`specialnames`.
``__*`` ``__*``
Class-private names. Names in this category, when used within the context of a Class-private names. Names in this category, when used within the context of a
class definition, are re-written to use a mangled form to help avoid name class definition, are re-written to use a mangled form to help avoid name
clashes between "private" attributes of base and derived classes. See section clashes between "private" attributes of base and derived classes. See section
:ref:`atom-identifiers`, "Identifiers (Names)." :ref:`atom-identifiers`.
.. _literals: .. _literals:

View File

@@ -904,7 +904,7 @@ it is a string, the string is parsed as a suite of Python statements which is
then executed (unless a syntax error occurs). If it is an open file, the file then executed (unless a syntax error occurs). If it is an open file, the file
is parsed until EOF and executed. If it is a code object, it is simply is parsed until EOF and executed. If it is a code object, it is simply
executed. In all cases, the code that's executed is expected to be valid as executed. In all cases, the code that's executed is expected to be valid as
file input (see section :ref:`file-input`, "File input"). Be aware that the file input (see section :ref:`file-input`). Be aware that the
:keyword:`return` and :keyword:`yield` statements may not be used outside of :keyword:`return` and :keyword:`yield` statements may not be used outside of
function definitions even within the context of code passed to the function definitions even within the context of code passed to the
:keyword:`exec` statement. :keyword:`exec` statement.

View File

@@ -316,7 +316,7 @@ naming of the standard exceptions.
Many standard modules define their own exceptions to report errors that may Many standard modules define their own exceptions to report errors that may
occur in functions they define. More information on classes is presented in occur in functions they define. More information on classes is presented in
chapter :ref:`tut-classes`, "Classes." chapter :ref:`tut-classes`.
.. _tut-cleanup: .. _tut-cleanup:

View File

@@ -152,16 +152,15 @@ directory names. When :envvar:`PYTHONPATH` is not set, or when the file is not
found there, the search continues in an installation-dependent default path; on found there, the search continues in an installation-dependent default path; on
Unix, this is usually :file:`.:/usr/local/lib/python`. Unix, this is usually :file:`.:/usr/local/lib/python`.
Actually, modules are searched in the list of directories given by the variable Actually, modules are searched in the list of directories given by the variable
``sys.path`` which is initialized from the directory containing the input ``sys.path`` which is initialized from the directory containing the input script
script (or the current directory), :envvar:`PYTHONPATH` and the installation- (or the current directory), :envvar:`PYTHONPATH` and the installation- dependent
dependent default. This allows Python programs that know what they're doing to default. This allows Python programs that know what they're doing to modify or
modify or replace the module search path. Note that because the directory replace the module search path. Note that because the directory containing the
containing the script being run is on the search path, it is important that the script being run is on the search path, it is important that the script not have
script not have the same name as a standard module, or Python will attempt to the same name as a standard module, or Python will attempt to load the script as
load the script as a module when that module is imported. This will generally be a module when that module is imported. This will generally be an error. See
an error. See section :ref:`tut-standardmodules`, "Standard Modules," for more section :ref:`tut-standardmodules` for more information.
information.
"Compiled" Python files "Compiled" Python files

View File

@@ -1838,9 +1838,8 @@ returning data from the target object.
.. index:: single: PyBufferProcs .. index:: single: PyBufferProcs
More information on the buffer interface is provided in the section "Buffer More information on the buffer interface is provided in the section
Object Structures" (section :ref:`buffer-structs`), under the description for :ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`.
:ctype:`PyBufferProcs`.
A "buffer object" is defined in the :file:`bufferobject.h` header (included by A "buffer object" is defined in the :file:`bufferobject.h` header (included by
:file:`Python.h`). These objects look very similar to string objects at the :file:`Python.h`). These objects look very similar to string objects at the

View File

@@ -701,8 +701,8 @@ XXX
.. cmember:: PyBufferProcs* PyTypeObject.tp_as_buffer .. cmember:: PyBufferProcs* PyTypeObject.tp_as_buffer
Pointer to an additional structure that contains fields relevant only to objects Pointer to an additional structure that contains fields relevant only to objects
which implement the buffer interface. These fields are documented in "Buffer which implement the buffer interface. These fields are documented in
Object Structures" (section :ref:`buffer-structs`). :ref:`buffer-structs`.
The :attr:`tp_as_buffer` field is not inherited, but the contained fields are The :attr:`tp_as_buffer` field is not inherited, but the contained fields are
inherited individually. inherited individually.

View File

@@ -453,15 +453,14 @@ be part of a module definition::
} }
This function must be registered with the interpreter using the This function must be registered with the interpreter using the
:const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`, :const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The
"The Module's Method Table and Initialization Function." The
:cfunc:`PyArg_ParseTuple` function and its arguments are documented in section :cfunc:`PyArg_ParseTuple` function and its arguments are documented in section
:ref:`parsetuple`, "Extracting Parameters in Extension Functions." :ref:`parsetuple`.
The macros :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` increment/decrement the The macros :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` increment/decrement the
reference count of an object and are safe in the presence of *NULL* pointers reference count of an object and are safe in the presence of *NULL* pointers
(but note that *temp* will not be *NULL* in this context). More info on them (but note that *temp* will not be *NULL* in this context). More info on them
in section :ref:`refcounts`, "Reference Counts." in section :ref:`refcounts`.
.. index:: single: PyEval_CallObject() .. index:: single: PyEval_CallObject()

View File

@@ -42,7 +42,7 @@ XXX: input{boilerplate} :XXX
.. % end{latexonly} .. % end{latexonly}
.. _intro: .. _inst-intro:
Introduction Introduction
============ ============
@@ -67,7 +67,7 @@ on how to distribute your own Python modules so that others may use them, see
the Distributing Python Modules (XXX reference: ../dist/dist.html) manual. the Distributing Python Modules (XXX reference: ../dist/dist.html) manual.
.. _trivial-install: .. _inst-trivial-install:
Best case: trivial installation Best case: trivial installation
------------------------------- -------------------------------
@@ -95,7 +95,7 @@ standard way. The bulk of this document is about building and installing
modules from standard source distributions. modules from standard source distributions.
.. _new-standard: .. _inst-new-standard:
The new standard: Distutils The new standard: Distutils
--------------------------- ---------------------------
@@ -119,12 +119,12 @@ really need this manual. Or rather, the above command is everything you need to
get out of this manual. get out of this manual.
.. _standard-install: .. _inst-standard-install:
Standard Build and Install Standard Build and Install
========================== ==========================
As described in section :ref:`new-standard`, building and installing a module As described in section :ref:`inst-new-standard`, building and installing a module
distribution using the Distutils is usually one simple command:: distribution using the Distutils is usually one simple command::
python setup.py install python setup.py install
@@ -134,7 +134,7 @@ open a command prompt window ("DOS box") and do it there; on Mac OS X, you open
a :command:`Terminal` window to get a shell prompt. a :command:`Terminal` window to get a shell prompt.
.. _platform-variations: .. _inst-platform-variations:
Platform variations Platform variations
------------------- -------------------
@@ -159,7 +159,7 @@ command prompt window ("DOS box"), and run::
python setup.py install python setup.py install
.. _splitting-up: .. _inst-splitting-up:
Splitting the job up Splitting the job up
-------------------- --------------------
@@ -189,7 +189,7 @@ tasks. If you get into distributing your own Python modules and extensions,
you'll run lots of individual Distutils commands on their own. you'll run lots of individual Distutils commands on their own.
.. _how-build-works: .. _inst-how-build-works:
How building works How building works
------------------ ------------------
@@ -203,7 +203,7 @@ to keep the source tree pristine, you can change the build directory with the
python setup.py build --build-base=/tmp/pybuild/foo-1.0 python setup.py build --build-base=/tmp/pybuild/foo-1.0
(Or you could do this permanently with a directive in your system or personal (Or you could do this permanently with a directive in your system or personal
Distutils configuration file; see section :ref:`config-files`.) Normally, this Distutils configuration file; see section :ref:`inst-config-files`.) Normally, this
isn't necessary. isn't necessary.
The default layout for the build tree is as follows:: The default layout for the build tree is as follows::
@@ -228,7 +228,7 @@ documentation, binary executables, and whatever else is needed to handle the job
of installing Python modules and applications. of installing Python modules and applications.
.. _how-install-works: .. _inst-how-install-works:
How installation works How installation works
---------------------- ----------------------
@@ -290,12 +290,12 @@ statements shown below, and get the output as shown, to find out my
If you don't want to install modules to the standard location, or if you don't If you don't want to install modules to the standard location, or if you don't
have permission to write there, then you need to read about alternate have permission to write there, then you need to read about alternate
installations in section :ref:`alt-install`. If you want to customize your installations in section :ref:`inst-alt-install`. If you want to customize your
installation directories more heavily, see section :ref:`custom-install` on installation directories more heavily, see section :ref:`inst-custom-install` on
custom installations. custom installations.
.. _alt-install: .. _inst-alt-install:
Alternate Installation Alternate Installation
====================== ======================
@@ -317,7 +317,7 @@ differ across platforms, so read whichever of the following sections applies to
you. you.
.. _alt-install-prefix: .. _inst-alt-install-prefix:
Alternate installation: the home scheme Alternate installation: the home scheme
--------------------------------------- ---------------------------------------
@@ -358,7 +358,7 @@ installed to the following directories under the installation base as follows:
The :option:`--home` option used to be supported only on Unix. The :option:`--home` option used to be supported only on Unix.
.. _alt-install-home: .. _inst-alt-install-home:
Alternate installation: Unix (the prefix scheme) Alternate installation: Unix (the prefix scheme)
------------------------------------------------ ------------------------------------------------
@@ -430,7 +430,7 @@ if your :option:`--prefix` and :option:`--exec-prefix` don't even point to an
alternate Python installation, this is immaterial.) alternate Python installation, this is immaterial.)
.. _alt-install-windows: .. _inst-alt-install-windows:
Alternate installation: Windows (the prefix scheme) Alternate installation: Windows (the prefix scheme)
--------------------------------------------------- ---------------------------------------------------
@@ -461,13 +461,13 @@ installed as follows:
+------------------------------+---------------------------+-----------------------------+ +------------------------------+---------------------------+-----------------------------+
.. _custom-install: .. _inst-custom-install:
Custom Installation Custom Installation
=================== ===================
Sometimes, the alternate installation schemes described in section Sometimes, the alternate installation schemes described in section
:ref:`alt-install` just don't do what you want. You might want to tweak just :ref:`inst-alt-install` just don't do what you want. You might want to tweak just
one or two directories while keeping everything under the same base directory, one or two directories while keeping everything under the same base directory,
or you might want to completely redefine the installation scheme. In either or you might want to completely redefine the installation scheme. In either
case, you're creating a *custom installation scheme*. case, you're creating a *custom installation scheme*.
@@ -513,7 +513,7 @@ For example::
The specified installation directories are relative to :file:`{prefix}`. Of The specified installation directories are relative to :file:`{prefix}`. Of
course, you also have to ensure that these directories are in Python's module course, you also have to ensure that these directories are in Python's module
search path, such as by putting a :file:`.pth` file in :file:`{prefix}`. See search path, such as by putting a :file:`.pth` file in :file:`{prefix}`. See
section :ref:`search-path` to find out how to modify Python's search path. section :ref:`inst-search-path` to find out how to modify Python's search path.
If you want to define an entire installation scheme, you just have to supply all If you want to define an entire installation scheme, you just have to supply all
of the installation directory options. The recommended way to do this is to of the installation directory options. The recommended way to do this is to
@@ -548,7 +548,7 @@ parsing your configuration file(s).
Obviously, specifying the entire installation scheme every time you install a Obviously, specifying the entire installation scheme every time you install a
new module distribution would be very tedious. Thus, you can put these options new module distribution would be very tedious. Thus, you can put these options
into your Distutils config file (see section :ref:`config-files`):: into your Distutils config file (see section :ref:`inst-config-files`)::
[install] [install]
install-base=$HOME install-base=$HOME
@@ -582,7 +582,7 @@ environment variables in config files on platforms that have such a notion but
the Distutils additionally define a few extra variables that may not be in your the Distutils additionally define a few extra variables that may not be in your
environment, such as ``$PLAT``. (And of course, on systems that don't have environment, such as ``$PLAT``. (And of course, on systems that don't have
environment variables, such as Mac OS 9, the configuration variables supplied by environment variables, such as Mac OS 9, the configuration variables supplied by
the Distutils are the only ones you can use.) See section :ref:`config-files` the Distutils are the only ones you can use.) See section :ref:`inst-config-files`
for details. for details.
.. % XXX need some Windows examples---when would custom .. % XXX need some Windows examples---when would custom
@@ -591,7 +591,7 @@ for details.
.. % XXX I'm not sure where this section should go. .. % XXX I'm not sure where this section should go.
.. _search-path: .. _inst-search-path:
Modifying Python's Search Path Modifying Python's Search Path
------------------------------ ------------------------------
@@ -670,7 +670,7 @@ Finally, ``sys.path`` is just a regular Python list, so any Python application
can modify it by adding or removing entries. can modify it by adding or removing entries.
.. _config-files: .. _inst-config-files:
Distutils Configuration Files Distutils Configuration Files
============================= =============================
@@ -685,7 +685,7 @@ multiple configuration files apply, values from "earlier" files are overridden
by "later" files. by "later" files.
.. _config-filenames: .. _inst-config-filenames:
Location and names of config files Location and names of config files
---------------------------------- ----------------------------------
@@ -748,7 +748,7 @@ Notes:
Distutils make no attempt to guess your home directory on Windows.) Distutils make no attempt to guess your home directory on Windows.)
.. _config-syntax: .. _inst-config-syntax:
Syntax of config files Syntax of config files
---------------------- ----------------------
@@ -802,7 +802,7 @@ and you can find out the complete list of global options by using
See also the "Reference" section of the "Distributing Python Modules" manual. See also the "Reference" section of the "Distributing Python Modules" manual.
.. _building-ext: .. _inst-building-ext:
Building Extensions: Tips and Tricks Building Extensions: Tips and Tricks
==================================== ====================================
@@ -815,7 +815,7 @@ complicated situations this might be inappropriate. This section discusses how
to override the usual Distutils behaviour. to override the usual Distutils behaviour.
.. _tweak-flags: .. _inst-tweak-flags:
Tweaking compiler/linker flags Tweaking compiler/linker flags
------------------------------ ------------------------------
@@ -885,7 +885,7 @@ environment variable. If set, the contents of :envvar:`CFLAGS` will be added to
the compiler flags specified in the :file:`Setup` file. the compiler flags specified in the :file:`Setup` file.
.. _non-ms-compilers: .. _inst-non-ms-compilers:
Using non-Microsoft compilers on Windows Using non-Microsoft compilers on Windows
---------------------------------------- ----------------------------------------
@@ -932,7 +932,7 @@ To let Distutils compile your extension with Borland C++ you now have to type::
If you want to use the Borland C++ compiler as the default, you could specify If you want to use the Borland C++ compiler as the default, you could specify
this in your personal or system-wide configuration file for Distutils (see this in your personal or system-wide configuration file for Distutils (see
section :ref:`config-files`.) section :ref:`inst-config-files`.)
.. seealso:: .. seealso::
@@ -998,7 +998,7 @@ and for Cygwin in no-cygwin mode [#]_ or for MinGW type::
If you want to use any of these options/compilers as default, you should If you want to use any of these options/compilers as default, you should
consider to write it in your personal or system-wide configuration file for consider to write it in your personal or system-wide configuration file for
Distutils (see section :ref:`config-files`.) Distutils (see section :ref:`inst-config-files`.)
.. seealso:: .. seealso::

View File

@@ -8,7 +8,7 @@
This module provides direct access to all 'built-in' identifiers of Python; for This module provides direct access to all 'built-in' identifiers of Python; for
example, ``__builtin__.open`` is the full name for the built-in function example, ``__builtin__.open`` is the full name for the built-in function
:func:`open`. See chapter :ref:`builtin`, "Built-in Objects." :func:`open`. See chapter :ref:`builtin`.
This module is not normally accessed explicitly by most applications, but can be This module is not normally accessed explicitly by most applications, but can be
useful in modules that provide objects with the same name as a built-in value, useful in modules that provide objects with the same name as a built-in value,

View File

@@ -72,7 +72,7 @@ The :mod:`csv` module defines the following functions:
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparam* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`, "Dialects and Formatting Parameters". section :ref:`csv-fmt-params`.
All data read are returned as strings. No automatic data type conversion is All data read are returned as strings. No automatic data type conversion is
performed. performed.
@@ -99,7 +99,7 @@ The :mod:`csv` module defines the following functions:
:func:`list_dialects` function. The other optional *fmtparam* keyword arguments :func:`list_dialects` function. The other optional *fmtparam* keyword arguments
can be given to override individual formatting parameters in the current can be given to override individual formatting parameters in the current
dialect. For full details about the dialect and formatting parameters, see dialect. For full details about the dialect and formatting parameters, see
section :ref:`csv-fmt-params`, "Dialects and Formatting Parameters". To make it section :ref:`csv-fmt-params`. To make it
as easy as possible to interface with modules which implement the DB API, the as easy as possible to interface with modules which implement the DB API, the
value :const:`None` is written as the empty string. While this isn't a value :const:`None` is written as the empty string. While this isn't a
reversible transformation, it makes it easier to dump SQL NULL data values to reversible transformation, it makes it easier to dump SQL NULL data values to
@@ -113,8 +113,7 @@ The :mod:`csv` module defines the following functions:
dialect can be specified either by passing a sub-class of :class:`Dialect`, or dialect can be specified either by passing a sub-class of :class:`Dialect`, or
by *fmtparam* keyword arguments, or both, with keyword arguments overriding by *fmtparam* keyword arguments, or both, with keyword arguments overriding
parameters of the dialect. For full details about the dialect and formatting parameters of the dialect. For full details about the dialect and formatting
parameters, see section :ref:`csv-fmt-params`, "Dialects and Formatting parameters, see section :ref:`csv-fmt-params`.
Parameters".
.. function:: unregister_dialect(name) .. function:: unregister_dialect(name)

View File

@@ -2359,6 +2359,6 @@ with the same name, or create new attributes for names not present in
Arrays and pointers Arrays and pointers
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
Not yet written - please see section :ref:`ctypes-pointers`, pointers and Not yet written - please see the sections :ref:`ctypes-pointers` and
section :ref:`ctypes-arrays`, arrays in the tutorial. section :ref:`ctypes-arrays` in the tutorial.

View File

@@ -491,7 +491,7 @@ Instance methods:
Return a string representing the date, controlled by an explicit format string. Return a string representing the date, controlled by an explicit format string.
Format codes referring to hours, minutes or seconds will see 0 values. See Format codes referring to hours, minutes or seconds will see 0 values. See
section :ref:`strftime-behavior` -- :meth:`strftime` behavior. section :ref:`strftime-behavior`.
.. _datetime-datetime: .. _datetime-datetime:
@@ -931,7 +931,7 @@ Instance methods:
.. method:: datetime.strftime(format) .. method:: datetime.strftime(format)
Return a string representing the date and time, controlled by an explicit format Return a string representing the date and time, controlled by an explicit format
string. See section :ref:`strftime-behavior` -- :meth:`strftime` behavior. string. See section :ref:`strftime-behavior`.
.. _datetime-time: .. _datetime-time:
@@ -1056,7 +1056,7 @@ Instance methods:
.. method:: time.strftime(format) .. method:: time.strftime(format)
Return a string representing the time, controlled by an explicit format string. Return a string representing the time, controlled by an explicit format string.
See section :ref:`strftime-behavior` -- :meth:`strftime` behavior. See section :ref:`strftime-behavior`.
.. method:: time.utcoffset() .. method:: time.utcoffset()

View File

@@ -451,10 +451,9 @@ available. They are listed here in alphabetical order.
.. function:: file(filename[, mode[, bufsize]]) .. function:: file(filename[, mode[, bufsize]])
Constructor function for the :class:`file` type, described further in section Constructor function for the :class:`file` type, described further in section
:ref:`bltin-file-objects`, "File Objects (XXX reference: bltin-file- :ref:`bltin-file-objects`. The constructor's arguments are the same as those
objects.html)". The constructor's arguments are the same as those of the of the :func:`open` built-in function described below.
:func:`open` built-in function described below.
When opening a file, it's preferable to use :func:`open` instead of invoking When opening a file, it's preferable to use :func:`open` instead of invoking
this constructor directly. :class:`file` is more suited to type testing (for this constructor directly. :class:`file` is more suited to type testing (for
@@ -743,11 +742,10 @@ available. They are listed here in alphabetical order.
.. function:: open(filename[, mode[, bufsize]]) .. function:: open(filename[, mode[, bufsize]])
Open a file, returning an object of the :class:`file` type described in section Open a file, returning an object of the :class:`file` type described in
:ref:`bltin-file-objects`, "File Objects (XXX reference: bltin-file- section :ref:`bltin-file-objects`. If the file cannot be opened,
objects.html)". If the file cannot be opened, :exc:`IOError` is raised. When :exc:`IOError` is raised. When opening a file, it's preferable to use
opening a file, it's preferable to use :func:`open` instead of invoking the :func:`open` instead of invoking the :class:`file` constructor directly.
:class:`file` constructor directly.
The first two arguments are the same as for ``stdio``'s :cfunc:`fopen`: The first two arguments are the same as for ``stdio``'s :cfunc:`fopen`:
*filename* is the file name to be opened, and *mode* is a string indicating how *filename* is the file name to be opened, and *mode* is a string indicating how

View File

@@ -44,9 +44,8 @@ browse the table of contents (in front of the manual), or look for a specific
function, module or term in the index (in the back). And finally, if you enjoy function, module or term in the index (in the back). And finally, if you enjoy
learning about random subjects, you choose a random page number (see module learning about random subjects, you choose a random page number (see module
:mod:`random`) and read a section or two. Regardless of the order in which you :mod:`random`) and read a section or two. Regardless of the order in which you
read the sections of this manual, it helps to start with chapter read the sections of this manual, it helps to start with chapter :ref:`builtin`,
:ref:`builtin`, "Built-in Types, Exceptions and Functions," as the remainder of as the remainder of the manual assumes familiarity with this material.
the manual assumes familiarity with this material.
Let the show begin! Let the show begin!

View File

@@ -1483,8 +1483,8 @@ A Formatter can be initialized with a format string which makes use of knowledge
of the :class:`LogRecord` attributes - such as the default value mentioned above of the :class:`LogRecord` attributes - such as the default value mentioned above
making use of the fact that the user's message and arguments are pre-formatted making use of the fact that the user's message and arguments are pre-formatted
into a :class:`LogRecord`'s *message* attribute. This format string contains into a :class:`LogRecord`'s *message* attribute. This format string contains
standard python %-style mapping keys. See section :ref:`typesseq-strings`, standard python %-style mapping keys. See section :ref:`typesseq-strings`
"String Formatting Operations," for more information on string formatting. for more information on string formatting.
Currently, the useful mapping keys in a :class:`LogRecord` are: Currently, the useful mapping keys in a :class:`LogRecord` are:

View File

@@ -309,7 +309,7 @@ Understanding option actions
Actions tell :mod:`optparse` what to do when it encounters an option on the Actions tell :mod:`optparse` what to do when it encounters an option on the
command line. There is a fixed set of actions hard-coded into :mod:`optparse`; command line. There is a fixed set of actions hard-coded into :mod:`optparse`;
adding new actions is an advanced topic covered in section adding new actions is an advanced topic covered in section
:ref:`optparse-extending-optparse`, Extending :mod:`optparse`. Most actions tell :ref:`optparse-extending-optparse`. Most actions tell
:mod:`optparse` to store a value in some variable---for example, take a string :mod:`optparse` to store a value in some variable---for example, take a string
from the command line and store it in an attribute of ``options``. from the command line and store it in an attribute of ``options``.
@@ -369,8 +369,7 @@ long option strings, :mod:`optparse` looks at the first short option string: the
default destination for ``"-f"`` is ``f``. default destination for ``"-f"`` is ``f``.
:mod:`optparse` also includes built-in ``long`` and ``complex`` types. Adding :mod:`optparse` also includes built-in ``long`` and ``complex`` types. Adding
types is covered in section :ref:`optparse-extending-optparse`, Extending types is covered in section :ref:`optparse-extending-optparse`.
:mod:`optparse`.
.. _optparse-handling-boolean-options: .. _optparse-handling-boolean-options:
@@ -415,7 +414,7 @@ Some other actions supported by :mod:`optparse` are:
call a specified function call a specified function
These are covered in section :ref:`optparse-reference-guide`, Reference Guide These are covered in section :ref:`optparse-reference-guide`, Reference Guide
and section :ref:`optparse-option-callbacks`, Option Callbacks. and section :ref:`optparse-option-callbacks`.
.. _optparse-default-values: .. _optparse-default-values:
@@ -704,8 +703,7 @@ not rely on the order in which the arguments are declared.
``conflict_handler`` (default: ``"error"``) ``conflict_handler`` (default: ``"error"``)
Specifies what to do when options with conflicting option strings are added to Specifies what to do when options with conflicting option strings are added to
the parser; see section :ref:`optparse-conflicts-between-options`, Conflicts the parser; see section :ref:`optparse-conflicts-between-options`.
between options.
``description`` (default: ``None``) ``description`` (default: ``None``)
A paragraph of text giving a brief overview of your program. :mod:`optparse` A paragraph of text giving a brief overview of your program. :mod:`optparse`
@@ -734,8 +732,7 @@ Populating the parser
There are several ways to populate the parser with options. The preferred way There are several ways to populate the parser with options. The preferred way
is by using ``OptionParser.add_option()``, as shown in section is by using ``OptionParser.add_option()``, as shown in section
:ref:`optparse-tutorial`, the tutorial. :meth:`add_option` can be called in one :ref:`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:
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`)
@@ -986,7 +983,7 @@ must specify for any option using that action.
func(option, opt_str, value, parser, *args, **kwargs) func(option, opt_str, value, parser, *args, **kwargs)
See section :ref:`optparse-option-callbacks`, Option Callbacks for more detail. See section :ref:`optparse-option-callbacks` for more detail.
* :attr:`help` * :attr:`help`
@@ -1083,9 +1080,9 @@ to a particular option, or fail to pass a required option attribute,
* ``callback`` * ``callback``
For options with action ``"callback"``, the callable to call when this option is For options with action ``"callback"``, the callable to call when this option
seen. See section :ref:`optparse-option-callbacks`, Option Callbacks for detail is seen. See section :ref:`optparse-option-callbacks` for detail on the
on the arguments passed to ``callable``. arguments passed to ``callable``.
* ``callback_args``, ``callback_kwargs`` * ``callback_args``, ``callback_kwargs``
@@ -1102,7 +1099,7 @@ to a particular option, or fail to pass a required option attribute,
* ``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 Stand-in for the option argument(s) to use when printing help text. See section
:ref:`optparse-tutorial`, the tutorial for an example. :ref:`optparse-tutorial` for an example.
.. _optparse-standard-option-types: .. _optparse-standard-option-types:
@@ -1112,7 +1109,7 @@ Standard option types
:mod:`optparse` has six built-in option types: ``string``, ``int``, ``long``, :mod:`optparse` has six built-in option types: ``string``, ``int``, ``long``,
``choice``, ``float`` and ``complex``. If you need to add new option types, see ``choice``, ``float`` and ``complex``. If you need to add new option types, see
section :ref:`optparse-extending-optparse`, Extending :mod:`optparse`. section :ref:`optparse-extending-optparse`.
Arguments to string options are not checked or converted in any way: the text on Arguments to string options are not checked or converted in any way: the text on
the command line is stored in the destination (or passed to the callback) as-is. the command line is stored in the destination (or passed to the callback) as-is.

View File

@@ -122,8 +122,7 @@ process and user.
getcwd() getcwd()
:noindex: :noindex:
These functions are described in "Files and Directories" (section These functions are described in :ref:`os-file-dir`.
:ref:`os-file-dir`).
.. function:: ctermid() .. function:: ctermid()

View File

@@ -39,8 +39,7 @@ This module provides one exception and one type object:
.. exception:: ExpatError .. exception:: ExpatError
The exception raised when Expat reports an error. See section The exception raised when Expat reports an error. See section
:ref:`expaterror-objects`, "ExpatError Exceptions," for more information on :ref:`expaterror-objects` for more information on interpreting Expat errors.
interpreting Expat errors.
.. exception:: error .. exception:: error

View File

@@ -58,7 +58,7 @@ The :mod:`shlex` module defines the following class:
was introduced in Python 2.3, and defines the operational mode. When *posix* is was introduced in Python 2.3, and defines the operational mode. When *posix* is
not true (default), the :class:`shlex` instance will operate in compatibility not true (default), the :class:`shlex` instance will operate in compatibility
mode. When operating in POSIX mode, :class:`shlex` will try to be as close as mode. When operating in POSIX mode, :class:`shlex` will try to be as close as
possible to the POSIX shell parsing rules. See section :ref:`shlex-objects`. possible to the POSIX shell parsing rules.
.. seealso:: .. seealso::

View File

@@ -571,13 +571,12 @@ correspond to Unix system calls applicable to sockets.
.. index:: single: I/O control; buffering .. index:: single: I/O control; buffering
Return a :dfn:`file object` associated with the socket. (File objects are Return a :dfn:`file object` associated with the socket. (File objects are
described in :ref:`bltin-file-objects`, "File Objects.") The file object described in :ref:`bltin-file-objects`.) The file object
references a :cfunc:`dup`\ ped version of the socket file descriptor, so the references a :cfunc:`dup`\ ped version of the socket file descriptor, so the
file object and socket object may be closed or garbage-collected independently. file object and socket object may be closed or garbage-collected independently.
The socket must be in blocking mode (it can not have a timeout). The optional The socket must be in blocking mode (it can not have a timeout). The optional
*mode* and *bufsize* arguments are interpreted the same way as by the built-in *mode* and *bufsize* arguments are interpreted the same way as by the built-in
:func:`file` function; see "Built-in Functions" (section :ref:`built-in-funcs`) :func:`file` function; see :ref:`built-in-funcs` for more information.
for more information.
.. method:: socket.recv(bufsize[, flags]) .. method:: socket.recv(bufsize[, flags])

View File

@@ -227,8 +227,8 @@ A :class:`Connection` instance has the following attributes and methods:
.. attribute:: Connection.isolation_level .. attribute:: Connection.isolation_level
Get or set the current isolation level. None for autocommit mode or one of Get or set the current isolation level. None for autocommit mode or one of
"DEFERRED", "IMMEDIATE" or "EXLUSIVE". See "Controlling Transactions", section "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section
:ref:`sqlite3-controlling-transactions`, for a more detailed explanation. :ref:`sqlite3-controlling-transactions` for a more detailed explanation.
.. method:: Connection.cursor([cursorClass]) .. method:: Connection.cursor([cursorClass])
@@ -629,9 +629,8 @@ the database is actually a point. There are two ways of doing this:
* Explicitly via the column name * Explicitly via the column name
Both ways are described in "Module Constants", section Both ways are described in section :ref:`sqlite3-module-contents`, in the entries
:ref:`sqlite3-module-contents`, in the entries for the constants for the constants :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES`.
:const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES`.
The following example illustrates both approaches. The following example illustrates both approaches.

View File

@@ -333,7 +333,7 @@ Notes:
for well-defined conversions. for well-defined conversions.
(3) (3)
See section :ref:`built-in-funcs`, "Built-in Functions," for a full description. See :ref:`built-in-funcs` for a full description.
(4) (4)
Complex floor division operator, modulo operator, and :func:`divmod`. Complex floor division operator, modulo operator, and :func:`divmod`.
@@ -1722,9 +1722,9 @@ File Objects
File objects are implemented using C's ``stdio`` package and can be created with File objects are implemented using C's ``stdio`` package and can be created with
the built-in constructor :func:`file` described in section the built-in constructor :func:`file` described in section
:ref:`built-in-funcs`, "Built-in Functions." [#]_ File objects are also :ref:`built-in-funcs`. [#]_ File objects are also returned by some other
returned by some other built-in functions and methods, such as :func:`os.popen` built-in functions and methods, such as :func:`os.popen` and :func:`os.fdopen`
and :func:`os.fdopen` and the :meth:`makefile` method of socket objects. and the :meth:`makefile` method of socket objects.
When a file operation fails for an I/O-related reason, the exception When a file operation fails for an I/O-related reason, the exception
:exc:`IOError` is raised. This includes situations where the operation is not :exc:`IOError` is raised. This includes situations where the operation is not
@@ -2339,4 +2339,3 @@ types, where they are relevant. Some of these are not reported by the
might matter, for example, if you want to make an exact copy of a file while might matter, for example, if you want to make an exact copy of a file while
scanning its lines) to tell whether the last line of a file ended in a newline scanning its lines) to tell whether the last line of a file ended in a newline
or not (yes this happens!). or not (yes this happens!).

View File

@@ -245,10 +245,9 @@ Deprecated string functions
--------------------------- ---------------------------
The following list of functions are also defined as methods of string and The following list of functions are also defined as methods of string and
Unicode objects; see "String Methods" (section :ref:`string-methods`) for more Unicode objects; see section :ref:`string-methods` for more information on
information on those. You should consider these functions as deprecated, those. You should consider these functions as deprecated, although they will
although they will not be removed until Python 3.0. The functions defined in not be removed until Python 3.0. The functions defined in this module are:
this module are:
.. function:: atof(s) .. function:: atof(s)

View File

@@ -331,7 +331,7 @@ always available.
Their intended use is to allow an interactive user to import a debugger module Their intended use is to allow an interactive user to import a debugger module
and engage in post-mortem debugging without having to re-execute the command and engage in post-mortem debugging without having to re-execute the command
that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the that caused the error. (Typical use is ``import pdb; pdb.pm()`` to enter the
post-mortem debugger; see chapter :ref:`debugger`, "The Python Debugger," for post-mortem debugger; see chapter :ref:`debugger` for
more information.) more information.)
The meaning of the variables is the same as that of the return values from The meaning of the variables is the same as that of the return values from
@@ -490,9 +490,9 @@ always available.
single: trace function single: trace function
single: debugger single: debugger
Set the system's trace function, which allows you to implement a Python source Set the system's trace function, which allows you to implement a Python
code debugger in Python. See section :ref:`debugger-hooks`, "How It Works," in source code debugger in Python. See section :ref:`debugger-hooks` in the
the chapter on the Python debugger. The function is thread-specific; for a chapter on the Python debugger. The function is thread-specific; for a
debugger to support multiple threads, it must be registered using debugger to support multiple threads, it must be registered using
:func:`settrace` for each thread being debugged. :func:`settrace` for each thread being debugged.

View File

@@ -37,7 +37,7 @@ Some facts and figures:
Return a :class:`TarFile` object for the pathname *name*. For detailed Return a :class:`TarFile` object for the pathname *name*. For detailed
information on :class:`TarFile` objects and the keyword arguments that are information on :class:`TarFile` objects and the keyword arguments that are
allowed, see TarFile Objects (section :ref:`tarfile-objects`). allowed, see :ref:`tarfile-objects`.
*mode* has to be a string of the form ``'filemode[:compression]'``, it defaults *mode* has to be a string of the form ``'filemode[:compression]'``, it defaults
to ``'r'``. Here is a full list of mode combinations: to ``'r'``. Here is a full list of mode combinations:
@@ -75,14 +75,14 @@ Some facts and figures:
For special purposes, there is a second format for *mode*: For special purposes, there is a second format for *mode*:
``'filemode|[compression]'``. :func:`open` will return a :class:`TarFile` ``'filemode|[compression]'``. :func:`open` will return a :class:`TarFile`
object that processes its data as a stream of blocks. No random seeking will be object that processes its data as a stream of blocks. No random seeking will
done on the file. If given, *fileobj* may be any object that has a :meth:`read` be done on the file. If given, *fileobj* may be any object that has a
or :meth:`write` method (depending on the *mode*). *bufsize* specifies the :meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize*
blocksize and defaults to ``20 * 512`` bytes. Use this variant in combination specifies the blocksize and defaults to ``20 * 512`` bytes. Use this variant
with e.g. ``sys.stdin``, a socket file object or a tape device. However, such a in combination with e.g. ``sys.stdin``, a socket file object or a tape
:class:`TarFile` object is limited in that it does not allow to be accessed device. However, such a :class:`TarFile` object is limited in that it does
randomly, see "Examples" (section :ref:`tar-examples`). The currently possible not allow to be accessed randomly, see :ref:`tar-examples`. The currently
modes: possible modes:
+-------------+--------------------------------------------+ +-------------+--------------------------------------------+
| Mode | Action | | Mode | Action |
@@ -112,8 +112,7 @@ Some facts and figures:
.. class:: TarFile .. class:: TarFile
Class for reading and writing tar archives. Do not use this class directly, Class for reading and writing tar archives. Do not use this class directly,
better use :func:`open` instead. See "TarFile Objects" (section better use :func:`open` instead. See :ref:`tarfile-objects`.
:ref:`tarfile-objects`).
.. function:: is_tarfile(name) .. function:: is_tarfile(name)
@@ -221,7 +220,7 @@ The :class:`TarFile` object provides an interface to a tar archive. A tar
archive is a sequence of blocks. An archive member (a stored file) is made up of archive is a sequence of blocks. An archive member (a stored file) is made up of
a header block followed by data blocks. It is possible to store a file in a tar a header block followed by data blocks. It is possible to store a file in a tar
archive several times. Each archive member is represented by a :class:`TarInfo` archive several times. Each archive member is represented by a :class:`TarInfo`
object, see TarInfo Objects (section :ref:`tarinfo-objects`) for details. object, see :ref:`tarinfo-objects` for details.
.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=None, errors=None, pax_headers=None, debug=0, errorlevel=0) .. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=None, errors=None, pax_headers=None, debug=0, errorlevel=0)

View File

@@ -22,9 +22,8 @@ consult the Tk documentation, and occasionally the Tcl documentation.
classes. In addition, the internal module :mod:`_tkinter` provides a threadsafe classes. In addition, the internal module :mod:`_tkinter` provides a threadsafe
mechanism which allows Python and Tcl to interact. mechanism which allows Python and Tcl to interact.
Tk is not the only GUI for Python; see section :ref:`other-gui-packages`, "Other Tk is not the only GUI for Python; see section :ref:`other-gui-packages` for
User Interface Modules and Packages," for more information on other GUI toolkits more information on other GUI toolkits for Python.
for Python.
.. % Other sections I have in mind are .. % Other sections I have in mind are
.. % Tkinter internals .. % Tkinter internals

View File

@@ -90,8 +90,8 @@ The :mod:`urlparse` module defines the following functions:
| | | if present | | | | | if present | |
+------------------+-------+--------------------------+----------------------+ +------------------+-------+--------------------------+----------------------+
See section :ref:`urlparse-result-object`, "Results of :func:`urlparse` and See section :ref:`urlparse-result-object` for more information on the result
:func:`urlsplit`," for more information on the result object. object.
.. versionchanged:: 2.5 .. versionchanged:: 2.5
Added attributes to return value. Added attributes to return value.
@@ -141,8 +141,8 @@ The :mod:`urlparse` module defines the following functions:
| | | if present | | | | | if present | |
+------------------+-------+-------------------------+----------------------+ +------------------+-------+-------------------------+----------------------+
See section :ref:`urlparse-result-object`, "Results of :func:`urlparse` and See section :ref:`urlparse-result-object` for more information on the result
:func:`urlsplit`," for more information on the result object. object.
.. versionadded:: 2.2 .. versionadded:: 2.2

View File

@@ -177,8 +177,8 @@ The :mod:`UserString` module defines the following classes:
hard to track down. hard to track down.
In addition to supporting the methods and operations of string and Unicode In addition to supporting the methods and operations of string and Unicode
objects (see section :ref:`string-methods`, "String Methods"), objects (see section :ref:`string-methods`), :class:`UserString` instances
:class:`UserString` instances provide the following attribute: provide the following attribute:
.. attribute:: MutableString.data .. attribute:: MutableString.data

View File

@@ -65,8 +65,7 @@ The specification provided by the W3C defines the DOM API for Java, ECMAScript,
and OMG IDL. The Python mapping defined here is based in large part on the IDL and OMG IDL. The Python mapping defined here is based in large part on the IDL
version of the specification, but strict compliance is not required (though version of the specification, but strict compliance is not required (though
implementations are free to support the strict mapping from IDL). See section implementations are free to support the strict mapping from IDL). See section
:ref:`dom-conformance`, "Conformance," for a detailed discussion of mapping :ref:`dom-conformance` for a detailed discussion of mapping requirements.
requirements.
.. seealso:: .. seealso::
@@ -173,40 +172,40 @@ Note that DOM attributes may also be manipulated as nodes instead of as simple
strings. It is fairly rare that you must do this, however, so this usage is not strings. It is fairly rare that you must do this, however, so this usage is not
yet documented. yet documented.
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| Interface | Section | Purpose | | Interface | Section | Purpose |
+================================+=================================+=================================+ +================================+===================================+=================================+
| :class:`DOMImplementation` | :ref:`dom-implementation- | Interface to the underlying | | :class:`DOMImplementation` | :ref:`dom-implementation-objects` | Interface to the underlying |
| | objects` | implementation. | | | | implementation. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Node` | :ref:`dom-node-objects` | Base interface for most objects | | :class:`Node` | :ref:`dom-node-objects` | Base interface for most objects |
| | | in a document. | | | | in a document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`NodeList` | :ref:`dom-nodelist-objects` | Interface for a sequence of | | :class:`NodeList` | :ref:`dom-nodelist-objects` | Interface for a sequence of |
| | | nodes. | | | | nodes. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`DocumentType` | :ref:`dom-documenttype-objects` | Information about the | | :class:`DocumentType` | :ref:`dom-documenttype-objects` | Information about the |
| | | declarations needed to process | | | | declarations needed to process |
| | | a document. | | | | a document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Document` | :ref:`dom-document-objects` | Object which represents an | | :class:`Document` | :ref:`dom-document-objects` | Object which represents an |
| | | entire document. | | | | entire document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Element` | :ref:`dom-element-objects` | Element nodes in the document | | :class:`Element` | :ref:`dom-element-objects` | Element nodes in the document |
| | | hierarchy. | | | | hierarchy. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Attr` | :ref:`dom-attr-objects` | Attribute value nodes on | | :class:`Attr` | :ref:`dom-attr-objects` | Attribute value nodes on |
| | | element nodes. | | | | element nodes. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Comment` | :ref:`dom-comment-objects` | Representation of comments in | | :class:`Comment` | :ref:`dom-comment-objects` | Representation of comments in |
| | | the source document. | | | | the source document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`Text` | :ref:`dom-text-objects` | Nodes containing textual | | :class:`Text` | :ref:`dom-text-objects` | Nodes containing textual |
| | | content from the document. | | | | content from the document. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
| :class:`ProcessingInstruction` | :ref:`dom-pi-objects` | Processing instruction | | :class:`ProcessingInstruction` | :ref:`dom-pi-objects` | Processing instruction |
| | | representation. | | | | representation. |
+--------------------------------+---------------------------------+---------------------------------+ +--------------------------------+-----------------------------------+---------------------------------+
An additional section describes the exceptions defined for working with the DOM An additional section describes the exceptions defined for working with the DOM
in Python. in Python.

View File

@@ -70,24 +70,23 @@ a new parser object.
.. class:: AttributesImpl(attrs) .. class:: AttributesImpl(attrs)
This is an implementation of the :class:`Attributes` interface (XXX reference: This is an implementation of the :class:`Attributes` interface (see section
attributes-objects.html) (see section :ref:`attributes-objects`). This is a :ref:`attributes-objects`). This is a dictionary-like object which
dictionary-like object which represents the element attributes in a represents the element attributes in a :meth:`startElement` call. In addition
:meth:`startElement` call. In addition to the most useful dictionary operations, to the most useful dictionary operations, it supports a number of other
it supports a number of other methods as described by the interface. Objects of methods as described by the interface. Objects of this class should be
this class should be instantiated by readers; *attrs* must be a dictionary-like instantiated by readers; *attrs* must be a dictionary-like object containing
object containing a mapping from attribute names to attribute values. a mapping from attribute names to attribute values.
.. class:: AttributesNSImpl(attrs, qnames) .. class:: AttributesNSImpl(attrs, qnames)
Namespace-aware variant of :class:`AttributesImpl`, which will be passed to Namespace-aware variant of :class:`AttributesImpl`, which will be passed to
:meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but
understands attribute names as two-tuples of *namespaceURI* and *localname*. In understands attribute names as two-tuples of *namespaceURI* and
addition, it provides a number of methods expecting qualified names as they *localname*. In addition, it provides a number of methods expecting qualified
appear in the original document. This class implements the names as they appear in the original document. This class implements the
:class:`AttributesNS` interface (XXX reference: attributes-ns-objects.html) (see :class:`AttributesNS` interface (see section :ref:`attributes-ns-objects`).
section :ref:`attributes-ns-objects`).
.. _xmlreader-objects: .. _xmlreader-objects:
@@ -359,9 +358,9 @@ including the methods :meth:`copy`, :meth:`get`, :meth:`has_key`, :meth:`items`,
The :class:`AttributesNS` Interface The :class:`AttributesNS` Interface
----------------------------------- -----------------------------------
This interface is a subtype of the :class:`Attributes` interface (XXX reference: This interface is a subtype of the :class:`Attributes` interface (see section
attributes-objects.html) (see section :ref:`attributes-objects`). All methods :ref:`attributes-objects`). All methods supported by that interface are also
supported by that interface are also available on :class:`AttributesNS` objects. available on :class:`AttributesNS` objects.
The following methods are also available: The following methods are also available:

View File

@@ -40,8 +40,8 @@ The available attributes of this module are:
.. class:: ZipFile .. class:: ZipFile
The class for reading and writing ZIP files. See "ZipFile Objects" (section The class for reading and writing ZIP files. See section
:ref:`zipfile-objects`) for constructor details. :ref:`zipfile-objects` for constructor details.
.. class:: PyZipFile .. class:: PyZipFile
@@ -51,14 +51,14 @@ The available attributes of this module are:
.. class:: ZipInfo([filename[, date_time]]) .. class:: ZipInfo([filename[, date_time]])
Class used to represent information about a member of an archive. Instances of Class used to represent information about a member of an archive. Instances
this class are returned by the :meth:`getinfo` and :meth:`infolist` methods of of this class are returned by the :meth:`getinfo` and :meth:`infolist`
:class:`ZipFile` objects. Most users of the :mod:`zipfile` module will not need methods of :class:`ZipFile` objects. Most users of the :mod:`zipfile` module
to create these, but only use those created by this module. *filename* should be will not need to create these, but only use those created by this
the full name of the archive member, and *date_time* should be a tuple module. *filename* should be the full name of the archive member, and
containing six fields which describe the time of the last modification to the *date_time* should be a tuple containing six fields which describe the time
file; the fields are described in section :ref:`zipinfo-objects`, "ZipInfo of the last modification to the file; the fields are described in section
Objects." :ref:`zipinfo-objects`.
.. function:: is_zipfile(filename) .. function:: is_zipfile(filename)

View File

@@ -40,8 +40,8 @@ The available attributes of this module are:
.. class:: zipimporter .. class:: zipimporter
The class for importing ZIP files. See "zipimporter Objects" (section The class for importing ZIP files. See section :ref:`zipimporter-objects`
:ref:`zipimporter-objects`) for constructor details. for constructor details.
.. seealso:: .. seealso::

View File

@@ -108,7 +108,7 @@ Finder is non-standard as the Finder does not read your :file:`.profile` or
/.MacOSX/environment.plist`. See Apple's Technical Document QA1067 for details. /.MacOSX/environment.plist`. See Apple's Technical Document QA1067 for details.
For more information on installation Python packages in MacPython, see section For more information on installation Python packages in MacPython, see section
:ref:`mac-package-manager`, "Installing Additional Python Packages." :ref:`mac-package-manager`.
.. _ide: .. _ide:

View File

@@ -441,7 +441,7 @@ Mappings
the same dictionary entry. the same dictionary entry.
Dictionaries are mutable; they can be created by the ``{...}`` notation (see Dictionaries are mutable; they can be created by the ``{...}`` notation (see
section :ref:`dict`, "Dictionary Displays"). section :ref:`dict`).
.. index:: .. index::
module: dbm module: dbm
@@ -461,7 +461,7 @@ Callable types
pair: function; argument pair: function; argument
These are the types to which the function call operation (see section These are the types to which the function call operation (see section
:ref:`calls`, "Calls") can be applied: :ref:`calls`) can be applied:
User-defined functions User-defined functions
.. index:: .. index::
@@ -469,9 +469,9 @@ Callable types
object: function object: function
object: user-defined function object: user-defined function
A user-defined function object is created by a function definition (see section A user-defined function object is created by a function definition (see
:ref:`function`, "Function definitions"). It should be called with an argument section :ref:`function`). It should be called with an argument list
list containing the same number of items as the function's formal parameter containing the same number of items as the function's formal parameter
list. list.
Special attributes: Special attributes:
@@ -652,7 +652,7 @@ Callable types
single: generator; iterator single: generator; iterator
A function or method which uses the :keyword:`yield` statement (see section A function or method which uses the :keyword:`yield` statement (see section
:ref:`yield`, "The :keyword:`yield` statement") is called a :dfn:`generator :ref:`yield`) is called a :dfn:`generator
function`. Such a function, when called, always returns an iterator object function`. Such a function, when called, always returns an iterator object
which can be used to execute the body of the function: calling the iterator's which can be used to execute the body of the function: calling the iterator's
:meth:`__next__` method will cause the function to execute until it provides a :meth:`__next__` method will cause the function to execute until it provides a
@@ -720,7 +720,7 @@ Modules
object: module object: module
Modules are imported by the :keyword:`import` statement (see section Modules are imported by the :keyword:`import` statement (see section
:ref:`import`, "The :keyword:`import` statement"). A module object has a :ref:`import`). A module object has a
namespace implemented by a dictionary object (this is the dictionary referenced namespace implemented by a dictionary object (this is the dictionary referenced
by the __globals__ attribute of functions defined in the module). Attribute by the __globals__ attribute of functions defined in the module). Attribute
references are translated to lookups in this dictionary, e.g., ``m.x`` is references are translated to lookups in this dictionary, e.g., ``m.x`` is
@@ -753,8 +753,8 @@ Modules
of the shared library file. of the shared library file.
Classes Classes
Class objects are created by class definitions (see section :ref:`class`, "Class Class objects are created by class definitions (see section :ref:`class`).
definitions"). A class has a namespace implemented by a dictionary object. Class A class has a namespace implemented by a dictionary object. Class
attribute references are translated to lookups in this dictionary, e.g., ``C.x`` attribute references are translated to lookups in this dictionary, e.g., ``C.x``
is translated to ``C.__dict__["x"]``. When the attribute name is not found is translated to ``C.__dict__["x"]``. When the attribute name is not found
there, the attribute search continues in the base classes. The search is depth- there, the attribute search continues in the base classes. The search is depth-
@@ -841,8 +841,7 @@ Class instances
object: mapping object: mapping
Class instances can pretend to be numbers, sequences, or mappings if they have Class instances can pretend to be numbers, sequences, or mappings if they have
methods with certain special names. See section :ref:`specialnames`, "Special methods with certain special names. See section :ref:`specialnames`.
method names."
.. index:: .. index::
single: __dict__ (instance attribute) single: __dict__ (instance attribute)
@@ -1008,7 +1007,7 @@ Internal types
unwinds the execution stack, at each unwound level a traceback object is unwinds the execution stack, at each unwound level a traceback object is
inserted in front of the current traceback. When an exception handler is inserted in front of the current traceback. When an exception handler is
entered, the stack trace is made available to the program. (See section entered, the stack trace is made available to the program. (See section
:ref:`try`, "The ``try`` statement.") It is accessible as the third item of the :ref:`try`.) It is accessible as the third item of the
tuple returned by ``sys.exc_info()``. When the program contains no suitable tuple returned by ``sys.exc_info()``. When the program contains no suitable
handler, the stack trace is written (nicely formatted) to the standard error handler, the stack trace is written (nicely formatted) to the standard error
stream; if the interpreter is interactive, it is also made available to the user stream; if the interpreter is interactive, it is also made available to the user

View File

@@ -1199,7 +1199,7 @@ precedence (least binding) to highest precedence (most binding). Operators in
the same box have the same precedence. Unless the syntax is explicitly given, the same box have the same precedence. Unless the syntax is explicitly given,
operators are binary. Operators in the same box group left to right (except for operators are binary. Operators in the same box group left to right (except for
comparisons, including tests, which all have the same precedence and chain from comparisons, including tests, which all have the same precedence and chain from
left to right --- see section :ref:`comparisons` -- and exponentiation, which left to right --- see section :ref:`comparisons` --- and exponentiation, which
groups from right to left). groups from right to left).
+----------------------------------------------+-------------------------------------+ +----------------------------------------------+-------------------------------------+

View File

@@ -385,8 +385,7 @@ characters:
Not imported by ``from module import *``. The special identifier ``_`` is used Not imported by ``from module import *``. The special identifier ``_`` is used
in the interactive interpreter to store the result of the last evaluation; it is in the interactive interpreter to store the result of the last evaluation; it is
stored in the :mod:`__builtin__` module. When not in interactive mode, ``_`` stored in the :mod:`__builtin__` module. When not in interactive mode, ``_``
has no special meaning and is not defined. See section :ref:`import`, "The has no special meaning and is not defined. See section :ref:`import`.
:keyword:`import` statement."
.. note:: .. note::
@@ -399,13 +398,13 @@ characters:
implementation (including the standard library); applications should not expect implementation (including the standard library); applications should not expect
to define additional names using this convention. The set of names of this to define additional names using this convention. The set of names of this
class defined by Python may be extended in future versions. See section class defined by Python may be extended in future versions. See section
:ref:`specialnames`, "Special method names." :ref:`specialnames`.
``__*`` ``__*``
Class-private names. Names in this category, when used within the context of a Class-private names. Names in this category, when used within the context of a
class definition, are re-written to use a mangled form to help avoid name class definition, are re-written to use a mangled form to help avoid name
clashes between "private" attributes of base and derived classes. See section clashes between "private" attributes of base and derived classes. See section
:ref:`atom-identifiers`, "Identifiers (Names)." :ref:`atom-identifiers`.
.. _literals: .. _literals:

View File

@@ -323,7 +323,7 @@ naming of the standard exceptions.
Many standard modules define their own exceptions to report errors that may Many standard modules define their own exceptions to report errors that may
occur in functions they define. More information on classes is presented in occur in functions they define. More information on classes is presented in
chapter :ref:`tut-classes`, "Classes." chapter :ref:`tut-classes`.
.. _tut-cleanup: .. _tut-cleanup:

View File

@@ -152,16 +152,15 @@ directory names. When :envvar:`PYTHONPATH` is not set, or when the file is not
found there, the search continues in an installation-dependent default path; on found there, the search continues in an installation-dependent default path; on
Unix, this is usually :file:`.:/usr/local/lib/python`. Unix, this is usually :file:`.:/usr/local/lib/python`.
Actually, modules are searched in the list of directories given by the variable Actually, modules are searched in the list of directories given by the variable
``sys.path`` which is initialized from the directory containing the input ``sys.path`` which is initialized from the directory containing the input script
script (or the current directory), :envvar:`PYTHONPATH` and the installation- (or the current directory), :envvar:`PYTHONPATH` and the installation- dependent
dependent default. This allows Python programs that know what they're doing to default. This allows Python programs that know what they're doing to modify or
modify or replace the module search path. Note that because the directory replace the module search path. Note that because the directory containing the
containing the script being run is on the search path, it is important that the script being run is on the search path, it is important that the script not have
script not have the same name as a standard module, or Python will attempt to the same name as a standard module, or Python will attempt to load the script as
load the script as a module when that module is imported. This will generally be a module when that module is imported. This will generally be an error. See
an error. See section :ref:`tut-standardmodules`, "Standard Modules," for more section :ref:`tut-standardmodules` for more information.
information.
"Compiled" Python files "Compiled" Python files