Commit 81ac1ce5 authored by Georg Brandl's avatar Georg Brandl

Address a few XXX comments, other fixes.

parent dcc56f8b
...@@ -4,3 +4,4 @@ To do ...@@ -4,3 +4,4 @@ To do
* split very large files and add toctrees * split very large files and add toctrees
* finish "Documenting Python" * finish "Documenting Python"
* care about XXX comments * care about XXX comments
* X-refs to statements
...@@ -1155,7 +1155,7 @@ The next fields, up to and including :attr:`tp_weaklist`, only exist if the ...@@ -1155,7 +1155,7 @@ The next fields, up to and including :attr:`tp_weaklist`, only exist if the
PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type); PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);
XXX blah, blah. XXX more
This field is inherited by subtypes. This field is inherited by subtypes.
...@@ -1170,7 +1170,7 @@ The next fields, up to and including :attr:`tp_weaklist`, only exist if the ...@@ -1170,7 +1170,7 @@ The next fields, up to and including :attr:`tp_weaklist`, only exist if the
This field is inherited by subtypes. This field is inherited by subtypes.
XXX blah, blah. XXX more
.. cmember:: long PyTypeObject.tp_dictoffset .. cmember:: long PyTypeObject.tp_dictoffset
...@@ -1595,9 +1595,6 @@ objects which may also be containers. Types which do not store references to ...@@ -1595,9 +1595,6 @@ objects which may also be containers. Types which do not store references to
other objects, or which only store references to atomic types (such as numbers other objects, or which only store references to atomic types (such as numbers
or strings), do not need to provide any explicit support for garbage collection. or strings), do not need to provide any explicit support for garbage collection.
.. An example showing the use of these interfaces can be found in "Supporting the
.. Cycle Collector (XXX not found: ../ext/example-cycle-support.html)".
To create a container type, the :attr:`tp_flags` field of the type object must To create a container type, the :attr:`tp_flags` field of the type object must
include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
:attr:`tp_traverse` handler. If instances of the type are mutable, a :attr:`tp_traverse` handler. If instances of the type are mutable, a
......
...@@ -232,8 +232,6 @@ at a shell should produce a file :file:`noddy.so` in a subdirectory; move to ...@@ -232,8 +232,6 @@ at a shell should produce a file :file:`noddy.so` in a subdirectory; move to
that directory and fire up Python --- you should be able to ``import noddy`` and that directory and fire up Python --- you should be able to ``import noddy`` and
play around with Noddy objects. play around with Noddy objects.
.. % $ <-- bow to font-lock ;-(
That wasn't so hard, was it? That wasn't so hard, was it?
Of course, the current Noddy type is pretty uninteresting. It has no data and Of course, the current Noddy type is pretty uninteresting. It has no data and
......
...@@ -517,11 +517,7 @@ might define the following installation scheme:: ...@@ -517,11 +517,7 @@ might define the following installation scheme::
--install-scripts=python/scripts --install-scripts=python/scripts
--install-data=python/data --install-data=python/data
or, equivalently, or, equivalently, ::
.. % $ % -- bow to font-lock
::
python setup.py install --home=~/python \ python setup.py install --home=~/python \
--install-purelib=lib \ --install-purelib=lib \
...@@ -533,8 +529,6 @@ or, equivalently, ...@@ -533,8 +529,6 @@ or, equivalently,
the Distutils as it parses your command line options, just as it does when the Distutils as it parses your command line options, just as it does when
parsing your configuration file(s). parsing your configuration file(s).
.. % $ % -- bow to font-lock
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:`inst-config-files`):: into your Distutils config file (see section :ref:`inst-config-files`)::
......
...@@ -1170,7 +1170,6 @@ Several constants are available to specify character cell attributes: ...@@ -1170,7 +1170,6 @@ Several constants are available to specify character cell attributes:
Keys are referred to by integer constants with names starting with ``KEY_``. Keys are referred to by integer constants with names starting with ``KEY_``.
The exact keycaps available are system dependent. The exact keycaps available are system dependent.
.. % XXX this table is far too large!
.. % XXX should this table be alphabetized? .. % XXX should this table be alphabetized?
+-------------------+--------------------------------------------+ +-------------------+--------------------------------------------+
......
...@@ -126,12 +126,9 @@ The following exceptions are the exceptions that are actually raised. ...@@ -126,12 +126,9 @@ The following exceptions are the exceptions that are actually raised.
.. exception:: EOFError .. exception:: EOFError
Raised when attempting to read beyond the end of a file. (N.B.: the :meth:`read` Raised when attempting to read beyond the end of a file. (N.B.: the
and :meth:`readline` methods of file objects return an empty string when they :meth:`file.read` and :meth:`file.readline` methods return an empty string
hit EOF.) when they hit EOF.)
.. % XXXJH xrefs here
.. % XXXJH xrefs here
.. exception:: FloatingPointError .. exception:: FloatingPointError
...@@ -154,12 +151,10 @@ The following exceptions are the exceptions that are actually raised. ...@@ -154,12 +151,10 @@ The following exceptions are the exceptions that are actually raised.
.. exception:: IOError .. exception:: IOError
Raised when an I/O operation (such as a :keyword:`print` statement, the built-in Raised when an I/O operation (such as the built-in :func:`print` or
:func:`open` function or a method of a file object) fails for an I/O-related :func:`open` functions or a method of a file object) fails for an I/O-related
reason, e.g., "file not found" or "disk full". reason, e.g., "file not found" or "disk full".
.. % XXXJH xrefs here
This class is derived from :exc:`EnvironmentError`. See the discussion above This class is derived from :exc:`EnvironmentError`. See the discussion above
for more information on exception instance attributes. for more information on exception instance attributes.
...@@ -169,8 +164,6 @@ The following exceptions are the exceptions that are actually raised. ...@@ -169,8 +164,6 @@ The following exceptions are the exceptions that are actually raised.
Raised when an :keyword:`import` statement fails to find the module definition Raised when an :keyword:`import` statement fails to find the module definition
or when a ``from ... import`` fails to find a name that is to be imported. or when a ``from ... import`` fails to find a name that is to be imported.
.. % XXXJH xref to import statement?
.. exception:: IndexError .. exception:: IndexError
...@@ -191,12 +184,10 @@ The following exceptions are the exceptions that are actually raised. ...@@ -191,12 +184,10 @@ The following exceptions are the exceptions that are actually raised.
.. exception:: KeyboardInterrupt .. exception:: KeyboardInterrupt
Raised when the user hits the interrupt key (normally :kbd:`Control-C` or Raised when the user hits the interrupt key (normally :kbd:`Control-C` or
:kbd:`Delete`). During execution, a check for interrupts is made regularly. The :kbd:`Delete`). During execution, a check for interrupts is made
exception inherits from :exc:`BaseException` so as to not be accidentally caught regularly. The exception inherits from :exc:`BaseException` so as to not be
by code that catches :exc:`Exception` and thus prevent the interpreter from accidentally caught by code that catches :exc:`Exception` and thus prevent
exiting. the interpreter from exiting.
.. % XXX(hylton) xrefs here
.. versionchanged:: 2.5 .. versionchanged:: 2.5
Changed to inherit from :exc:`BaseException`. Changed to inherit from :exc:`BaseException`.
...@@ -246,11 +237,7 @@ The following exceptions are the exceptions that are actually raised. ...@@ -246,11 +237,7 @@ The following exceptions are the exceptions that are actually raised.
represented. This cannot occur for long integers (which would rather raise represented. This cannot occur for long integers (which would rather raise
:exc:`MemoryError` than give up). Because of the lack of standardization of :exc:`MemoryError` than give up). Because of the lack of standardization of
floating point exception handling in C, most floating point operations also floating point exception handling in C, most floating point operations also
aren't checked. For plain integers, all operations that can overflow are aren't checked.
checked except left shift, where typical applications prefer to drop bits than
raise an exception.
.. % XXXJH reference to long's and/or int's?
.. exception:: ReferenceError .. exception:: ReferenceError
...@@ -290,8 +277,6 @@ The following exceptions are the exceptions that are actually raised. ...@@ -290,8 +277,6 @@ The following exceptions are the exceptions that are actually raised.
or :func:`eval`, or when reading the initial script or standard input or :func:`eval`, or when reading the initial script or standard input
(also interactively). (also interactively).
.. % XXXJH xref to these functions?
Instances of this class have attributes :attr:`filename`, :attr:`lineno`, Instances of this class have attributes :attr:`filename`, :attr:`lineno`,
:attr:`offset` and :attr:`text` for easier access to the details. :func:`str` :attr:`offset` and :attr:`text` for easier access to the details. :func:`str`
of the exception instance returns only the message. of the exception instance returns only the message.
...@@ -319,8 +304,6 @@ The following exceptions are the exceptions that are actually raised. ...@@ -319,8 +304,6 @@ The following exceptions are the exceptions that are actually raised.
it has another type (such as a string), the object's value is printed and the it has another type (such as a string), the object's value is printed and the
exit status is one. exit status is one.
.. % XXX(hylton) xref to module sys?
Instances have an attribute :attr:`code` which is set to the proposed exit Instances have an attribute :attr:`code` which is set to the proposed exit
status or error message (defaulting to ``None``). Also, this exception derives status or error message (defaulting to ``None``). Also, this exception derives
directly from :exc:`BaseException` and not :exc:`Exception`, since it is not directly from :exc:`BaseException` and not :exc:`Exception`, since it is not
......
...@@ -9,13 +9,11 @@ ...@@ -9,13 +9,11 @@
This module helps scripts to parse the command line arguments in ``sys.argv``. This module helps scripts to parse the command line arguments in ``sys.argv``.
It supports the same conventions as the Unix :cfunc:`getopt` function (including It supports the same conventions as the Unix :cfunc:`getopt` function (including
the special meanings of arguments of the form '``-``' and '``-``\ ``-``'). Long the special meanings of arguments of the form '``-``' and '``--``'). Long
options similar to those supported by GNU software may be used as well via an options similar to those supported by GNU software may be used as well via an
optional third argument. This module provides a single function and an optional third argument. This module provides a single function and an
exception: exception:
.. % That's to fool latex2html into leaving the two hyphens alone!
.. function:: getopt(args, options[, long_options]) .. function:: getopt(args, options[, long_options])
...@@ -32,7 +30,7 @@ exception: ...@@ -32,7 +30,7 @@ exception:
work. work.
*long_options*, if specified, must be a list of strings with the names of the *long_options*, if specified, must be a list of strings with the names of the
long options which should be supported. The leading ``'-``\ ``-'`` characters long options which should be supported. The leading ``'--'`` characters
should not be included in the option name. Long options which require an should not be included in the option name. Long options which require an
argument should be followed by an equal sign (``'='``). To accept only long argument should be followed by an equal sign (``'='``). To accept only long
options, *options* should be an empty string. Long options on the command line options, *options* should be an empty string. Long options on the command line
...@@ -46,7 +44,7 @@ exception: ...@@ -46,7 +44,7 @@ exception:
option list was stripped (this is a trailing slice of *args*). Each option list was stripped (this is a trailing slice of *args*). Each
option-and-value pair returned has the option as its first element, prefixed option-and-value pair returned has the option as its first element, prefixed
with a hyphen for short options (e.g., ``'-x'``) or two hyphens for long with a hyphen for short options (e.g., ``'-x'``) or two hyphens for long
options (e.g., ``'-``\ ``-long-option'``), and the option argument as its options (e.g., ``'--long-option'``), and the option argument as its
second element, or an empty string if the option has no argument. The second element, or an empty string if the option has no argument. The
options occur in the list in the same order in which they were found, thus options occur in the list in the same order in which they were found, thus
allowing multiple occurrences. Long and short options may be mixed. allowing multiple occurrences. Long and short options may be mixed.
......
...@@ -611,7 +611,7 @@ This time, all messages with a severity of DEBUG or above were handled, and the ...@@ -611,7 +611,7 @@ This time, all messages with a severity of DEBUG or above were handled, and the
format of the messages was also changed, and output went to the specified file format of the messages was also changed, and output went to the specified file
rather than the console. rather than the console.
.. XXX logging should probably be updated! .. XXX logging should probably be updated for new string formatting!
Formatting uses the old Python string formatting - see section Formatting uses the old Python string formatting - see section
:ref:`old-string-formatting`. The format string takes the following common :ref:`old-string-formatting`. The format string takes the following common
......
...@@ -37,7 +37,7 @@ The :mod:`new` module defines the following functions: ...@@ -37,7 +37,7 @@ The :mod:`new` module defines the following functions:
This function is an interface to the :cfunc:`PyCode_New` C function. This function is an interface to the :cfunc:`PyCode_New` C function.
.. % XXX This is still undocumented!!!!!!!!!!! .. XXX This is still undocumented!!!
.. function:: module(name[, doc]) .. function:: module(name[, doc])
......
...@@ -316,7 +316,7 @@ indicates an error, the method raises one of the above exceptions. ...@@ -316,7 +316,7 @@ indicates an error, the method raises one of the above exceptions.
is supplied, then the returned *list* is an empty list. This is an optional NNTP is supplied, then the returned *list* is an empty list. This is an optional NNTP
extension, and may not be supported by all servers. extension, and may not be supported by all servers.
.. % XXX huh? Should that be name, description? .. % XXX huh? Should that be (name, description)?
RFC2980 says "It is suggested that this extension be deprecated". Use RFC2980 says "It is suggested that this extension be deprecated". Use
:meth:`descriptions` or :meth:`description` instead. :meth:`descriptions` or :meth:`description` instead.
......
...@@ -89,10 +89,6 @@ the standard audio interface for Linux and recent versions of FreeBSD. ...@@ -89,10 +89,6 @@ the standard audio interface for Linux and recent versions of FreeBSD.
second is required. This is a historical artifact for compatibility with the second is required. This is a historical artifact for compatibility with the
older :mod:`linuxaudiodev` module which :mod:`ossaudiodev` supersedes. older :mod:`linuxaudiodev` module which :mod:`ossaudiodev` supersedes.
.. % XXX it might also be motivated
.. % by my unfounded-but-still-possibly-true belief that the default
.. % audio device varies unpredictably across operating systems. -GW
.. function:: openmixer([device]) .. function:: openmixer([device])
......
...@@ -60,17 +60,11 @@ of Irix, but with Solaris 2.6 and 2.7 you need to do something like:: ...@@ -60,17 +60,11 @@ of Irix, but with Solaris 2.6 and 2.7 you need to do something like::
CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \ CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \
./configure ./configure
On large-file-capable Linux systems, this might work: On large-file-capable Linux systems, this might work::
.. % $ <-- bow to font-lock
::
CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" \ CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" \
./configure ./configure
.. % $ <-- bow to font-lock
.. _posix-contents: .. _posix-contents:
......
...@@ -504,7 +504,12 @@ form. ...@@ -504,7 +504,12 @@ form.
character class or preceded by an unescaped backslash, all characters from the character class or preceded by an unescaped backslash, all characters from the
leftmost such ``'#'`` through the end of the line are ignored. leftmost such ``'#'`` through the end of the line are ignored.
.. % XXX should add an example here This means that the two following regular expression objects are equal::
re.compile(r""" [a-z]+ # some letters
\.\. # two dots
[a-z]* # perhaps more letters""")
re.compile(r"[a-z]+\.\.[a-z]*")
.. function:: search(pattern, string[, flags]) .. function:: search(pattern, string[, flags])
......
...@@ -137,6 +137,17 @@ be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x < y and ...@@ -137,6 +137,17 @@ be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x < y and
y <= z``, except that *y* is evaluated only once (but in both cases *z* is not y <= z``, except that *y* is evaluated only once (but in both cases *z* is not
evaluated at all when ``x < y`` is found to be false). evaluated at all when ``x < y`` is found to be false).
.. index::
pair: operator; comparison
operator: ==
operator: <
operator: >
operator: <=
operator: >=
operator: !=
operator: is
operator: is not
This table summarizes the comparison operations: This table summarizes the comparison operations:
+------------+-------------------------+-------+ +------------+-------------------------+-------+
...@@ -159,14 +170,6 @@ This table summarizes the comparison operations: ...@@ -159,14 +170,6 @@ This table summarizes the comparison operations:
| ``is not`` | negated object identity | | | ``is not`` | negated object identity | |
+------------+-------------------------+-------+ +------------+-------------------------+-------+
.. index::
pair: operator; comparison
operator: ==
operator: is
operator: is not
.. % XXX *All* others have funny characters < ! >
.. index:: .. index::
pair: object; numeric pair: object; numeric
pair: objects; comparing pair: objects; comparing
...@@ -1021,7 +1024,7 @@ Old String Formatting Operations ...@@ -1021,7 +1024,7 @@ Old String Formatting Operations
single: % formatting single: % formatting
single: % interpolation single: % interpolation
.. XXX better? .. XXX is the note enough?
.. note:: .. note::
...@@ -1182,8 +1185,6 @@ Notes: ...@@ -1182,8 +1185,6 @@ Notes:
Since Python strings have an explicit length, ``%s`` conversions do not assume Since Python strings have an explicit length, ``%s`` conversions do not assume
that ``'\0'`` is the end of the string. that ``'\0'`` is the end of the string.
.. % XXX Examples?
For safety reasons, floating point precisions are clipped to 50; ``%f`` For safety reasons, floating point precisions are clipped to 50; ``%f``
conversions for numbers whose absolute value is over 1e25 are replaced by ``%g`` conversions for numbers whose absolute value is over 1e25 are replaced by ``%g``
conversions. [#]_ All other errors raise exceptions. conversions. [#]_ All other errors raise exceptions.
...@@ -1380,7 +1381,8 @@ In addition to the operations on mutable sequence types (see ...@@ -1380,7 +1381,8 @@ In addition to the operations on mutable sequence types (see
:ref:`typesseq-mutable`), bytes objects, being "mutable ASCII strings" have :ref:`typesseq-mutable`), bytes objects, being "mutable ASCII strings" have
further useful methods also found on strings. further useful methods also found on strings.
.. XXX documented "count" differently above .. XXX "count" is documented as a mutable sequence method differently above
.. XXX perhaps just split bytes and list methods
.. method:: bytes.count(sub[, start[, end]]) .. method:: bytes.count(sub[, start[, end]])
...@@ -1960,6 +1962,8 @@ File Objects ...@@ -1960,6 +1962,8 @@ File Objects
module: os module: os
module: socket module: socket
.. XXX this is quite out of date, must be updated with "io" module
File objects are implemented using C's ``stdio`` package and can be File objects are implemented using C's ``stdio`` package and can be
created with the built-in :func:`file` and (more usually) :func:`open` created with the built-in :func:`file` and (more usually) :func:`open`
constructors described in the :ref:`built-in-funcs` section. [#]_ File constructors described in the :ref:`built-in-funcs` section. [#]_ File
......
...@@ -66,5 +66,3 @@ described below. ...@@ -66,5 +66,3 @@ described below.
Module :mod:`tokenize` Module :mod:`tokenize`
Lexical scanner for Python source code. Lexical scanner for Python source code.
.. % XXX may be add a reference to IDLE?
...@@ -79,8 +79,6 @@ line:: ...@@ -79,8 +79,6 @@ line::
package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix] package ifneeded Tix 8.1 [list load "[file join $dir tix8183.dll]" Tix]
.. % $ <-- bow to font-lock
Tix Widgets Tix Widgets
----------- -----------
...@@ -489,16 +487,6 @@ In addition, :mod:`Tix` augments :mod:`Tkinter` by providing: ...@@ -489,16 +487,6 @@ In addition, :mod:`Tix` augments :mod:`Tkinter` by providing:
<http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm>`_ geometry <http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm>`_ geometry
manager based on attachment rules for all Tk widgets. manager based on attachment rules for all Tk widgets.
.. % begin{latexonly}
.. % \subsection{Tix Class Structure}
.. %
.. % \begin{figure}[hbtp]
.. % \centerline{\epsfig{file=hierarchy.png,width=.9\textwidth}}
.. % \vspace{.5cm}
.. % \caption{The Class Hierarchy of Tix Widgets}
.. % \end{figure}
.. % end{latexonly}
Tix Commands Tix Commands
------------ ------------
......
...@@ -182,17 +182,6 @@ documentation that exists. Here are some hints: ...@@ -182,17 +182,6 @@ documentation that exists. Here are some hints:
A Simple Hello World Program A Simple Hello World Program
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. % HelloWorld.html
.. % begin{latexonly}
.. % \begin{figure}[hbtp]
.. % \centerline{\epsfig{file=HelloWorld.gif,width=.9\textwidth}}
.. % \vspace{.5cm}
.. % \caption{HelloWorld gadget image}
.. % \end{figure}
.. % See also the hello-world \ulink{notes}{classes/HelloWorld-notes.html} and
.. % \ulink{summary}{classes/HelloWorld-summary.html}.
.. % end{latexonly}
:: ::
from Tkinter import * from Tkinter import *
......
...@@ -172,15 +172,3 @@ must be enabled by uncommenting the appropriate lines in :file:`Modules/Setup` ...@@ -172,15 +172,3 @@ must be enabled by uncommenting the appropriate lines in :file:`Modules/Setup`
in the build tree and either rebuilding Python if the modules are statically in the build tree and either rebuilding Python if the modules are statically
linked, or building and installing the shared object if using dynamically-loaded linked, or building and installing the shared object if using dynamically-loaded
extensions. extensions.
.. % %% lib-old is empty as of Python 2.5
.. % Those which are written in Python will be installed into the directory
.. % \file{lib-old/} installed as part of the standard library. To use
.. % these, the directory must be added to \code{sys.path}, possibly using
.. % \envvar{PYTHONPATH}.
.. % XXX need Windows instructions!
--- This section should be empty for Python 3.0.
...@@ -1193,12 +1193,6 @@ Basic customization ...@@ -1193,12 +1193,6 @@ Basic customization
used when an "informal" string representation of instances of that class is used when an "informal" string representation of instances of that class is
required. required.
.. index::
pair: string; conversion
pair: reverse; quotes
pair: backward; quotes
single: back-quotes
This is typically used for debugging, so it is important that the representation This is typically used for debugging, so it is important that the representation
is information-rich and unambiguous. is information-rich and unambiguous.
......
...@@ -11,13 +11,6 @@ with a prompt are output from the interpreter. Note that a secondary prompt on a ...@@ -11,13 +11,6 @@ with a prompt are output from the interpreter. Note that a secondary prompt on a
line by itself in an example means you must type a blank line; this is used to line by itself in an example means you must type a blank line; this is used to
end a multi-line command. end a multi-line command.
.. %
.. % \footnote{
.. % I'd prefer to use different fonts to distinguish input
.. % from output, but the amount of LaTeX hacking that would require
.. % is currently beyond my ability.
.. % }
Many of the examples in this manual, even those entered at the interactive Many of the examples in this manual, even those entered at the interactive
prompt, include comments. Comments in Python start with the hash character, prompt, include comments. Comments in Python start with the hash character,
``'#'``, and extend to the end of the physical line. A comment may appear at ``'#'``, and extend to the end of the physical line. A comment may appear at
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment