diff options
author | Georg Brandl <georg@python.org> | 2007-12-02 14:58:50 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-12-02 14:58:50 (GMT) |
commit | 584265b0010c660af21d3b22ac18fff0da678dd0 (patch) | |
tree | e8d6c884efe654560c7118d61b14296008a6f5b3 /Doc/library | |
parent | b15a8df51919ae428023df79fd078263d4d23c88 (diff) | |
download | cpython-584265b0010c660af21d3b22ac18fff0da678dd0.zip cpython-584265b0010c660af21d3b22ac18fff0da678dd0.tar.gz cpython-584265b0010c660af21d3b22ac18fff0da678dd0.tar.bz2 |
Add more entries to the glossary.
Written by Jeff Wheeler for GHOP.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/atexit.rst | 2 | ||||
-rw-r--r-- | Doc/library/bdb.rst | 2 | ||||
-rw-r--r-- | Doc/library/codecs.rst | 6 | ||||
-rw-r--r-- | Doc/library/codeop.rst | 4 | ||||
-rw-r--r-- | Doc/library/contextlib.rst | 6 | ||||
-rw-r--r-- | Doc/library/doctest.rst | 3 | ||||
-rw-r--r-- | Doc/library/functions.rst | 12 | ||||
-rw-r--r-- | Doc/library/functools.rst | 6 | ||||
-rw-r--r-- | Doc/library/inspect.rst | 2 | ||||
-rw-r--r-- | Doc/library/operator.rst | 8 | ||||
-rw-r--r-- | Doc/library/sets.rst | 6 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 4 | ||||
-rw-r--r-- | Doc/library/sys.rst | 18 | ||||
-rw-r--r-- | Doc/library/timeit.rst | 11 | ||||
-rw-r--r-- | Doc/library/weakref.rst | 32 |
15 files changed, 62 insertions, 60 deletions
diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst index 0c3cc3e..35bd3fe 100644 --- a/Doc/library/atexit.rst +++ b/Doc/library/atexit.rst @@ -96,7 +96,7 @@ passed along to the registered function when it is called:: # or: atexit.register(goodbye, adjective='nice', name='Donny') -Usage as a decorator:: +Usage as a :term:`decorator`:: import atexit diff --git a/Doc/library/bdb.rst b/Doc/library/bdb.rst index c44f9e3..a8a61f1 100644 --- a/Doc/library/bdb.rst +++ b/Doc/library/bdb.rst @@ -290,7 +290,7 @@ structure representing a stack trace. The following two methods can be called by clients to use a debugger to debug a -statement, given as a string. +:term:`statement`, given as a string. .. method:: Bdb.run(cmd, [globals, [locals]]) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 5bab2af..c6dc0a3 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -1119,9 +1119,9 @@ the table. | | | | all conversions. Can be | | | | | used as the system | | | | | encoding if no automatic | -| | | | coercion between byte and | -| | | | Unicode strings is | -| | | | desired. | +| | | | :term:`coercion` between | +| | | | byte and Unicode strings | +| | | | is desired. | +--------------------+---------------------------+----------------+---------------------------+ | unicode_escape | | Unicode string | Produce a string that is | | | | | suitable as Unicode | diff --git a/Doc/library/codeop.rst b/Doc/library/codeop.rst index 419e873..35430b4 100644 --- a/Doc/library/codeop.rst +++ b/Doc/library/codeop.rst @@ -43,8 +43,8 @@ To do just the former: :exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal. The *symbol* argument determines whether *source* is compiled as a statement - (``'single'``, the default) or as an expression (``'eval'``). Any other value - will cause :exc:`ValueError` to be raised. + (``'single'``, the default) or as an :term:`expression` (``'eval'``). Any + other value will cause :exc:`ValueError` to be raised. .. warning:: diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index a4b271f..11af432 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -17,9 +17,9 @@ Functions provided: .. function:: contextmanager(func) - This function is a decorator that can be used to define a factory function for - :keyword:`with` statement context managers, without needing to create a class or - separate :meth:`__enter__` and :meth:`__exit__` methods. + This function is a :term:`decorator` that can be used to define a factory + function for :keyword:`with` statement context managers, without needing to + create a class or separate :meth:`__enter__` and :meth:`__exit__` methods. A simple example (this is not recommended as a real way of generating HTML!):: diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 88ccb86..acc8d1b 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1135,7 +1135,8 @@ capabilities, then you should use the advanced API. The advanced API revolves around two container classes, which are used to store the interactive examples extracted from doctest cases: -* :class:`Example`: A single python statement, paired with its expected output. +* :class:`Example`: A single python :term:`statement`, paired with its expected + output. * :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted from a single docstring or text file. diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 1261547..1e71198 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -161,8 +161,8 @@ available. They are listed here in alphabetical order. @classmethod def f(cls, arg1, arg2, ...): ... - The ``@classmethod`` form is a function decorator -- see the description of - function definitions in :ref:`function` for details. + The ``@classmethod`` form is a function :term:`decorator` -- see the description + of function definitions in :ref:`function` for details. It can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). The instance is ignored except for its class. If a class @@ -825,7 +825,7 @@ available. They are listed here in alphabetical order. If given, *doc* will be the docstring of the property attribute. Otherwise, the property will copy *fget*'s docstring (if it exists). This makes it possible to - create read-only properties easily using :func:`property` as a decorator:: + create read-only properties easily using :func:`property` as a :term:`decorator`:: class Parrot(object): def __init__(self): @@ -1015,7 +1015,7 @@ available. They are listed here in alphabetical order. .. index:: single: Numerical Python - Return a slice object representing the set of indices specified by + Return a :term:`slice` object representing the set of indices specified by ``range(start, stop, step)``. The *start* and *step* arguments default to ``None``. Slice objects have read-only data attributes :attr:`start`, :attr:`stop` and :attr:`step` which merely return the argument values (or their @@ -1063,8 +1063,8 @@ available. They are listed here in alphabetical order. @staticmethod def f(arg1, arg2, ...): ... - The ``@staticmethod`` form is a function decorator -- see the description of - function definitions in :ref:`function` for details. + The ``@staticmethod`` form is a function :term:`decorator` -- see the + description of function definitions in :ref:`function` for details. It can be called either on the class (such as ``C.f()``) or on an instance (such as ``C().f()``). The instance is ignored except for its class. diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index f2f17b8..0f94848 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -68,9 +68,9 @@ The :mod:`functools` module defines the following functions: *WRAPPER_UPDATES* (which updates the wrapper function's *__dict__*, i.e. the instance dictionary). - The main intended use for this function is in decorator functions which wrap the - decorated function and return the wrapper. If the wrapper function is not - updated, the metadata of the returned function will reflect the wrapper + The main intended use for this function is in :term:`decorator` functions which + wrap the decorated function and return the wrapper. If the wrapper function is + not updated, the metadata of the returned function will reflect the wrapper definition rather than the original function definition, which is typically less than helpful. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 2c8041d..fbc9d04 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -235,7 +235,7 @@ Note: .. function:: isfunction(object) - Return true if the object is a Python function or unnamed (lambda) function. + Return true if the object is a Python function or unnamed (:term:`lambda`) function. .. function:: istraceback(object) diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 499a822..ea4d328 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -280,10 +280,10 @@ Operations which work with sequences include: Many operations have an "in-place" version. The following functions provide a more primitive access to in-place operators than the usual syntax does; for -example, the statement ``x += y`` is equivalent to ``x = operator.iadd(x, y)``. -Another way to put it is to say that ``z = operator.iadd(x, y)`` is equivalent -to the compound statement ``z = x; z += y``. - +example, the :term:`statement` ``x += y`` is equivalent to +``x = operator.iadd(x, y)``. Another way to put it is to say that +``z = operator.iadd(x, y)`` is equivalent to the compound statement +``z = x; z += y``. .. function:: iadd(a, b) __iadd__(a, b) diff --git a/Doc/library/sets.rst b/Doc/library/sets.rst index f9f8b59..88e442a 100644 --- a/Doc/library/sets.rst +++ b/Doc/library/sets.rst @@ -228,9 +228,9 @@ Sets can only contain immutable elements. For convenience, mutable :class:`Set` objects are automatically copied to an :class:`ImmutableSet` before being added as a set element. -The mechanism is to always add a hashable element, or if it is not hashable, the -element is checked to see if it has an :meth:`__as_immutable__` method which -returns an immutable equivalent. +The mechanism is to always add a :term:`hashable` element, or if it is not +hashable, the element is checked to see if it has an :meth:`__as_immutable__` +method which returns an immutable equivalent. Since :class:`Set` objects have a :meth:`__as_immutable__` method returning an instance of :class:`ImmutableSet`, it is possible to construct sets of sets. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 7419944..6b77d5b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2191,8 +2191,8 @@ decimal arithmetic context. The specific types are not treated specially beyond their implementation of the context management protocol. See the :mod:`contextlib` module for some examples. -Python's :term:`generator`\s and the ``contextlib.contextfactory`` decorator provide a -convenient way to implement these protocols. If a generator function is +Python's :term:`generator`\s and the ``contextlib.contextfactory`` :term:`decorator` +provide a convenient way to implement these protocols. If a generator function is decorated with the ``contextlib.contextfactory`` decorator, it will return a context manager implementing the necessary :meth:`__enter__` and :meth:`__exit__` methods, rather than the iterator produced by an undecorated diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 5669e35..f9c7f29 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -86,9 +86,9 @@ always available. If *value* is not ``None``, this function prints it to ``sys.stdout``, and saves it in ``__builtin__._``. - ``sys.displayhook`` is called on the result of evaluating an expression entered - in an interactive Python session. The display of these values can be customized - by assigning another one-argument function to ``sys.displayhook``. + ``sys.displayhook`` is called on the result of evaluating an :term:`expression` + entered in an interactive Python session. The display of these values can be + customized by assigning another one-argument function to ``sys.displayhook``. .. function:: excepthook(type, value, traceback) @@ -617,12 +617,12 @@ always available. File objects corresponding to the interpreter's standard input, output and error streams. ``stdin`` is used for all interpreter input except for scripts but including calls to :func:`input` and :func:`raw_input`. ``stdout`` is used for - the output of :keyword:`print` and expression statements and for the prompts of - :func:`input` and :func:`raw_input`. The interpreter's own prompts and (almost - all of) its error messages go to ``stderr``. ``stdout`` and ``stderr`` needn't - be built-in file objects: any object is acceptable as long as it has a - :meth:`write` method that takes a string argument. (Changing these objects - doesn't affect the standard I/O streams of processes executed by + the output of :keyword:`print` and :term:`expression` statements and for the + prompts of :func:`input` and :func:`raw_input`. The interpreter's own prompts + and (almost all of) its error messages go to ``stderr``. ``stdout`` and + ``stderr`` needn't be built-in file objects: any object is acceptable as long + as it has a :meth:`write` method that takes a string argument. (Changing these + objects doesn't affect the standard I/O streams of processes executed by :func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in the :mod:`os` module.) diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst index fe3c16c..c545b97 100644 --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -88,11 +88,12 @@ The module defines the following public class: .. note:: - By default, :meth:`timeit` temporarily turns off garbage collection during the - timing. The advantage of this approach is that it makes independent timings - more comparable. This disadvantage is that GC may be an important component of - the performance of the function being measured. If so, GC can be re-enabled as - the first statement in the *setup* string. For example:: + By default, :meth:`timeit` temporarily turns off :term:`garbage collection` + during the timing. The advantage of this approach is that it makes + independent timings more comparable. This disadvantage is that GC may be + an important component of the performance of the function being measured. + If so, GC can be re-enabled as the first statement in the *setup* string. + For example:: timeit.Timer('for i in xrange(10): oct(i)', 'gc.enable()').timeit() diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst index 225991a..7d9c588 100644 --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -22,22 +22,22 @@ In the following, the term :dfn:`referent` means the object which is referred to by a weak reference. A weak reference to an object is not enough to keep the object alive: when the -only remaining references to a referent are weak references, garbage collection -is free to destroy the referent and reuse its memory for something else. A -primary use for weak references is to implement caches or mappings holding large -objects, where it's desired that a large object not be kept alive solely because -it appears in a cache or mapping. For example, if you have a number of large -binary image objects, you may wish to associate a name with each. If you used a -Python dictionary to map names to images, or images to names, the image objects -would remain alive just because they appeared as values or keys in the -dictionaries. The :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` -classes supplied by the :mod:`weakref` module are an alternative, using weak -references to construct mappings that don't keep objects alive solely because -they appear in the mapping objects. If, for example, an image object is a value -in a :class:`WeakValueDictionary`, then when the last remaining references to -that image object are the weak references held by weak mappings, garbage -collection can reclaim the object, and its corresponding entries in weak -mappings are simply deleted. +only remaining references to a referent are weak references, +:term:`garbage collection` is free to destroy the referent and reuse its memory +for something else. A primary use for weak references is to implement caches or +mappings holding large objects, where it's desired that a large object not be +kept alive solely because it appears in a cache or mapping. For example, if you +have a number of large binary image objects, you may wish to associate a name +with each. If you used a Python dictionary to map names to images, or images to +names, the image objects would remain alive just because they appeared as values +or keys in the dictionaries. The :class:`WeakKeyDictionary` and +:class:`WeakValueDictionary` classes supplied by the :mod:`weakref` module are +an alternative, using weak references to construct mappings that don't keep +objects alive solely because they appear in the mapping objects. If, for +example, an image object is a value in a :class:`WeakValueDictionary`, then when +the last remaining references to that image object are the weak references held +by weak mappings, garbage collection can reclaim the object, and its +corresponding entries in weak mappings are simply deleted. :class:`WeakKeyDictionary` and :class:`WeakValueDictionary` use weak references in their implementation, setting up callback functions on the weak references |