diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/_thread.rst | 2 | ||||
-rw-r--r-- | Doc/library/codecs.rst | 3 | ||||
-rw-r--r-- | Doc/library/ctypes.rst | 2 | ||||
-rw-r--r-- | Doc/library/math.rst | 9 | ||||
-rw-r--r-- | Doc/library/optparse.rst | 7 | ||||
-rw-r--r-- | Doc/library/os.rst | 25 | ||||
-rw-r--r-- | Doc/library/signal.rst | 6 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 8 | ||||
-rw-r--r-- | Doc/library/string.rst | 7 |
9 files changed, 39 insertions, 30 deletions
diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst index 95214d6..cb62407 100644 --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -147,7 +147,7 @@ In addition to these methods, lock objects can also be used via the module is available, interrupts always go to the main thread.) * Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is - equivalent to calling :func:`exit`. + equivalent to calling :func:`_thread.exit`. * Not all built-in functions that may block waiting for I/O allow other threads to run. (The most popular ones (:func:`time.sleep`, :meth:`file.read`, diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index b8a8ccc..6e02063 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -891,7 +891,8 @@ or with dictionaries as mapping tables. The following table lists the codecs by name, together with a few common aliases, and the languages for which the encoding is likely used. Neither the list of aliases nor the list of languages is meant to be exhaustive. Notice that spelling alternatives that only differ in -case or use a hyphen instead of an underscore are also valid aliases. +case or use a hyphen instead of an underscore are also valid aliases; therefore, +e.g. ``'utf-8'`` is a valid alias for the ``'utf_8'`` codec. Many of the character sets support the same languages. They vary in individual characters (e.g. whether the EURO SIGN is supported or not), and in the diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index ded0df8..ad5adee 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1592,7 +1592,7 @@ type and the argument types of the function. The returned function prototype creates functions that use the standard C calling convention. The function will release the GIL during the call. If *use_errno* is set to True, the ctypes private copy of the system - :data:`errno` variable is exchanged with the real :data:`errno` value bafore + :data:`errno` variable is exchanged with the real :data:`errno` value before and after the call; *use_last_error* does the same for the Windows error code. diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 488230a..566603d 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -150,8 +150,10 @@ Power and logarithmic functions .. function:: log(x[, base]) - Return the logarithm of *x* to the given *base*. If the *base* is not specified, - return the natural logarithm of *x* (that is, the logarithm to base *e*). + With one argument, return the natural logarithm of *x* (to base *e*). + + With two arguments, return the logarithm of *x* to the given *base*, + calculated as ``log(x)/log(base)``. .. function:: log1p(x) @@ -162,7 +164,8 @@ Power and logarithmic functions .. function:: log10(x) - Return the base-10 logarithm of *x*. + Return the base-10 logarithm of *x*. This is usually more accurate + than ``log(x, 10)``. .. function:: pow(x, y) diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index 6320fa7..a62ad24 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -1166,19 +1166,20 @@ where the input parameters are the list of arguments to process (default: ``sys.argv[1:]``) ``values`` - object to store option arguments in (default: a new instance of optparse.Values) + object to store option arguments in (default: a new instance of + :class:`optparse.Values`) and the return values are ``options`` - the same object that was passed in as ``options``, or the optparse.Values + the same object that was passed in as ``values``, or the optparse.Values instance created by :mod:`optparse` ``args`` the leftover positional arguments after all options have been processed The most common usage is to supply neither keyword argument. If you supply -``options``, it will be modified with repeated ``setattr()`` calls (roughly one +``values``, it will be modified with repeated ``setattr()`` calls (roughly one for every option argument stored to an option destination) and returned by :meth:`parse_args`. diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 206a15c..9bed1ce 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -396,7 +396,7 @@ by file descriptors. Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive), ignoring errors. Availability: Unix, Windows. Equivalent to:: - for fd in xrange(fd_low, fd_high): + for fd in range(fd_low, fd_high): try: os.close(fd) except OSError: @@ -947,12 +947,12 @@ Files and Directories .. function:: remove(path) - Remove the file *path*. If *path* is a directory, :exc:`OSError` is raised; see - :func:`rmdir` below to remove a directory. This is identical to the - :func:`unlink` function documented below. On Windows, attempting to remove a - file that is in use causes an exception to be raised; on Unix, the directory - entry is removed but the storage allocated to the file is not made available - until the original file is no longer in use. Availability: Unix, + Remove (delete) the file *path*. If *path* is a directory, :exc:`OSError` is + raised; see :func:`rmdir` below to remove a directory. This is identical to + the :func:`unlink` function documented below. On Windows, attempting to + remove a file that is in use causes an exception to be raised; on Unix, the + directory entry is removed but the storage allocated to the file is not made + available until the original file is no longer in use. Availability: Unix, Windows. @@ -997,7 +997,10 @@ Files and Directories .. function:: rmdir(path) - Remove the directory *path*. Availability: Unix, Windows. + Remove (delete) the directory *path*. Only works when the directory is + empty, otherwise, :exc:`OSError` is raised. In order to remove whole + directory trees, :func:`shutil.rmtree` can be used. Availability: Unix, + Windows. .. function:: stat(path) @@ -1099,9 +1102,9 @@ Files and Directories .. function:: unlink(path) - Remove the file *path*. This is the same function as :func:`remove`; the - :func:`unlink` name is its traditional Unix name. Availability: Unix, - Windows. + Remove (delete) the file *path*. This is the same function as + :func:`remove`; the :func:`unlink` name is its traditional Unix + name. Availability: Unix, Windows. .. function:: utime(path, times) diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst index 2db17c5..7319ac9 100644 --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -205,9 +205,9 @@ The :mod:`signal` module defines the following functions: exception to be raised. The *handler* is called with two arguments: the signal number and the current - stack frame (``None`` or a frame object; for a description of frame objects, see - the reference manual section on the standard type hierarchy or see the attribute - descriptions in the :mod:`inspect` module). + stack frame (``None`` or a frame object; for a description of frame objects, + see the :ref:`description in the type hierarchy <frame-objects>` or see the + attribute descriptions in the :mod:`inspect` module). .. _signal-example: diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 14ad15e..f739f46 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1724,12 +1724,12 @@ The constructors for both classes work the same: .. method:: update(other, ...) set |= other | ... - Update the set, adding elements from *other*. + Update the set, adding elements from all others. .. method:: intersection_update(other, ...) set &= other & ... - Update the set, keeping only elements found in it and *other*. + Update the set, keeping only elements found in it and all others. .. method:: difference_update(other, ...) set -= other | ... @@ -2478,9 +2478,9 @@ 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`` :term:`decorator` +Python's :term:`generator`\s and the ``contextlib.contextmanager`` :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 +decorated with the ``contextlib.contextmanager`` decorator, it will return a context manager implementing the necessary :meth:`__enter__` and :meth:`__exit__` methods, rather than the iterator produced by an undecorated generator function. diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 95d27f1..6cb6cb6 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -194,7 +194,7 @@ literal text, it can be escaped by doubling: ``{{`` and ``}}``. The grammar for a replacement field is as follows: .. productionlist:: sf - replacement_field: "{" `field_name` ["!" `conversion`] [":" `format_spec`] "}" + replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}" field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")* arg_name: (`identifier` | `integer`)? attribute_name: `identifier` @@ -202,7 +202,7 @@ The grammar for a replacement field is as follows: conversion: "r" | "s" | "a" format_spec: <described in the next section> -In less formal terms, the replacement field starts with a *field_name* that specifies +In less formal terms, the replacement field can start with a *field_name* that specifies the object whose value is to be formatted and inserted into the output instead of the replacement field. The *field_name* is optionally followed by a *conversion* field, which is @@ -223,7 +223,7 @@ Some simple format string examples:: "First, thou shalt count to {0}" # References first positional argument "Bring me a {}" # Implicitly references the first positional argument - "From {} to {}" # Same as "From {0] to {1}" + "From {} to {}" # Same as "From {0} to {1}" "My quest is {name}" # References keyword argument 'name' "Weight in tons {0.weight}" # 'weight' attribute of first positional arg "Units destroyed: {players[0]}" # First element of keyword argument 'players'. @@ -243,6 +243,7 @@ Some examples:: "Harold's a clever {0!s}" # Calls str() on the argument first "Bring out the holy {name!r}" # Calls repr() on the argument first + "More {!a}" # Calls ascii() on the argument first The *format_spec* field contains a specification of how the value should be presented, including such details as field width, alignment, padding, decimal |