summaryrefslogtreecommitdiff
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/2to3.rst6
-rw-r--r--Doc/library/abc.rst2
-rw-r--r--Doc/library/contextlib.rst9
-rw-r--r--Doc/library/exceptions.rst2
-rw-r--r--Doc/library/filecmp.rst25
-rw-r--r--Doc/library/idle.rst18
-rw-r--r--Doc/library/re.rst2
-rw-r--r--Doc/library/stdtypes.rst2
-rw-r--r--Doc/library/string.rst21
-rw-r--r--Doc/library/sys.rst4
-rw-r--r--Doc/library/threading.rst7
-rw-r--r--Doc/library/time.rst18
-rw-r--r--Doc/library/turtle.rst6
-rw-r--r--Doc/library/xml.dom.rst2
14 files changed, 86 insertions, 38 deletions
diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst
index 375bd10e96..b1c2dd72cc 100644
--- a/Doc/library/2to3.rst
+++ b/Doc/library/2to3.rst
@@ -36,9 +36,9 @@ It can be converted to Python 3.x code via 2to3 on the command line::
$ 2to3 example.py
A diff against the original source file is printed. 2to3 can also write the
-needed modifications right back to the source file. (Of course, a backup of the
-original is also be made unless :option:`-n` is also given.) Writing the
-changes back is enabled with the :option:`-w` flag::
+needed modifications right back to the source file. (A backup of the original
+file is made unless :option:`-n` is also given.) Writing the changes back is
+enabled with the :option:`-w` flag::
$ 2to3 -w example.py
diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst
index 505fca12a1..9f70b024c4 100644
--- a/Doc/library/abc.rst
+++ b/Doc/library/abc.rst
@@ -153,7 +153,7 @@ It also provides the following decorators:
.. note::
- Unlike C++'s pure virtual functions, or Java abstract methods, these abstract
+ Unlike Java abstract methods, these abstract
methods may have an implementation. This implementation can be
called via the :func:`super` mechanism from the class that
overrides it. This could be useful as an end-point for a
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 8c10c95494..935afeeba9 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -63,14 +63,15 @@ Functions provided:
from contextlib import nested
- with nested(A, B, C) as (X, Y, Z):
+ with nested(A(), B(), C()) as (X, Y, Z):
do_something()
is equivalent to this::
- with A as X:
- with B as Y:
- with C as Z:
+ m1, m2, m3 = A(), B(), C()
+ with m1 as X:
+ with m2 as Y:
+ with m3 as Z:
do_something()
Note that if the :meth:`__exit__` method of one of the nested context managers
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 9673dab8f1..a50ffbfe64 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -52,7 +52,7 @@ The following exceptions are only used as base classes for other exceptions.
The base class for all built-in exceptions. It is not meant to be directly
inherited by user-defined classes (for that use :exc:`Exception`). If
:func:`str` or :func:`unicode` is called on an instance of this class, the
- representation of the argument(s) to the instance are returned or the emptry
+ representation of the argument(s) to the instance are returned or the empty
string when there were no arguments. All arguments are stored in :attr:`args`
as a tuple.
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst
index 3377d97436..11d74ba770 100644
--- a/Doc/library/filecmp.rst
+++ b/Doc/library/filecmp.rst
@@ -31,17 +31,24 @@ The :mod:`filecmp` module defines the following functions:
.. function:: cmpfiles(dir1, dir2, common[, shallow])
- Returns three lists of file names: *match*, *mismatch*, *errors*. *match*
- contains the list of files match in both directories, *mismatch* includes the
- names of those that don't, and *errros* lists the names of files which could not
- be compared. Files may be listed in *errors* because the user may lack
- permission to read them or many other reasons, but always that the comparison
- could not be done for some reason.
-
- The *common* parameter is a list of file names found in both directories. The
- *shallow* parameter has the same meaning and default value as for
+ Compare the files in the two directories *dir1* and *dir2* whose names are
+ given by *common*.
+
+ Returns three lists of file names: *match*, *mismatch*,
+ *errors*. *match* contains the list of files that match, *mismatch* contains
+ the names of those that don't, and *errors* lists the names of files which
+ could not be compared. Files are listed in *errors* if they don't exist in
+ one of the directories, the user lacks permission to read them or if the
+ comparison could not be done for some other reason.
+
+ The *shallow* parameter has the same meaning and default value as for
:func:`filecmp.cmp`.
+ For example, ``cmpfiles('a', 'b', ['c', 'd/e'])`` will compare ``a/c`` with
+ ``b/c`` and ``a/d/e`` with ``b/d/e``. ``'c'`` and ``'d/e'`` will each be in
+ one of the three returned lists.
+
+
Example::
>>> import filecmp
diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst
index 413750fda5..1b78fb9bc1 100644
--- a/Doc/library/idle.rst
+++ b/Doc/library/idle.rst
@@ -253,6 +253,24 @@ Shell colors:
black
+Startup
+-------
+
+Upon startup with the ``-s`` option, IDLE will execute the file referenced by
+the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`.
+Idle first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file
+referenced is run. If ``IDLESTARTUP`` is not present, Idle checks for
+``PYTHONSTARTUP``. Files referenced by these environment variables are
+convenient places to store functions that are used frequently from the Idle
+shell, or for executing import statements to import common modules.
+
+In addition, ``Tk`` also loads a startup file if it is present. Note that the
+Tk file is loaded unconditionally. This additional file is ``.Idle.py`` and is
+looked for in the user's home directory. Statements in this file will be
+executed in the Tk namespace, so this file is not useful for importing functions
+to be used from Idle's Python shell.
+
+
Command line usage
^^^^^^^^^^^^^^^^^^
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 6ff89eab03..d2c9558053 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -1093,7 +1093,7 @@ For example:
string)`` or ``re.search(pattern, string)``.
:func:`match` has an optional second parameter that gives an index in the string
-where the search is to start:
+where the search is to start::
>>> pattern = re.compile("o")
>>> pattern.match("dog") # No match as "o" is not at the start of "dog."
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 998ae77bdc..56b63128cd 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1296,7 +1296,7 @@ The conversion types are:
+------------+-----------------------------------------------------+-------+
| ``'o'`` | Signed octal value. | \(1) |
+------------+-----------------------------------------------------+-------+
-| ``'u'`` | Obselete type -- it is identical to ``'d'``. | \(7) |
+| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(7) |
+------------+-----------------------------------------------------+-------+
| ``'x'`` | Signed hexadecimal (lowercase). | \(2) |
+------------+-----------------------------------------------------+-------+
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 673f756bc6..4c3be4f20e 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -62,10 +62,9 @@ The constants defined in this module are:
.. data:: lowercase
A string containing all the characters that are considered lowercase letters.
- On most systems this is the string ``'abcdefghijklmnopqrstuvwxyz'``. Do not
- change its definition --- the effect on the routines :func:`upper` and
- :func:`swapcase` is undefined. The specific value is locale-dependent, and will
- be updated when :func:`locale.setlocale` is called.
+ On most systems this is the string ``'abcdefghijklmnopqrstuvwxyz'``. The
+ specific value is locale-dependent, and will be updated when
+ :func:`locale.setlocale` is called.
.. data:: octdigits
@@ -89,18 +88,16 @@ The constants defined in this module are:
.. data:: uppercase
A string containing all the characters that are considered uppercase letters.
- On most systems this is the string ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. Do not
- change its definition --- the effect on the routines :func:`lower` and
- :func:`swapcase` is undefined. The specific value is locale-dependent, and will
- be updated when :func:`locale.setlocale` is called.
+ On most systems this is the string ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. The
+ specific value is locale-dependent, and will be updated when
+ :func:`locale.setlocale` is called.
.. data:: whitespace
A string containing all characters that are considered whitespace. On most
systems this includes the characters space, tab, linefeed, return, formfeed, and
- vertical tab. Do not change its definition --- the effect on the routines
- :func:`strip` and :func:`split` is undefined.
+ vertical tab.
.. _new-string-formatting:
@@ -224,7 +221,7 @@ The grammar for a replacement field is as follows:
.. productionlist:: sf
replacement_field: "{" `field_name` ["!" `conversion`] [":" `format_spec`] "}"
- field_name: (`identifier` | `integer`) ("." `attribute_name` | "[" element_index "]")*
+ field_name: (`identifier` | `integer`) ("." `attribute_name` | "[" `element_index` "]")*
attribute_name: `identifier`
element_index: `integer`
conversion: "r" | "s"
@@ -599,7 +596,7 @@ They are not available as string methods.
Don't use strings derived from :const:`lowercase` and :const:`uppercase` as
arguments; in some locales, these don't have the same length. For case
- conversions, always use :func:`lower` and :func:`upper`.
+ conversions, always use :meth:`str.lower` and :meth:`str.upper`.
Deprecated string functions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index a476f4d301..61b757654a 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -661,7 +661,9 @@ always available.
.. data:: py3kwarning
Bool containing the status of the Python 3.0 warning flag. It's ``True``
- when Python is started with the -3 option.
+ when Python is started with the -3 option. (This should be considered
+ read-only; setting it to a different value doesn't have an effect on
+ Python 3.0 warnings.)
.. versionadded:: 2.6
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index e6616dbcd2..69593ae7b1 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -21,9 +21,14 @@ The :mod:`dummy_threading` module is provided for situations where
deprecation of the ``camelCase`` names and they remain fully supported in
both Python 2.x and 3.x.
-This module defines the following functions and objects:
+.. note::
+
+ Starting with Python 2.5, several Thread methods raise :exc:`RuntimeError`
+ instead of :exc:`AssertionError` if called erroneously.
+This module defines the following functions and objects:
+
.. function:: active_count()
activeCount()
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index c9b7355316..1ffef2b244 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -118,6 +118,24 @@ An explanation of some terminology and conventions is in order.
The time value sequence was changed from a tuple to a :class:`struct_time`, with
the addition of attribute names for the fields.
+* Use the following functions to convert between time representations:
+
+ +-------------------------+-------------------------+-------------------------+
+ | From | To | Use |
+ +=========================+=========================+=========================+
+ | seconds since the epoch | :class:`struct_time` in | :func:`gmtime` |
+ | | UTC | |
+ +-------------------------+-------------------------+-------------------------+
+ | seconds since the epoch | :class:`struct_time` in | :func:`localtime` |
+ | | local time | |
+ +-------------------------+-------------------------+-------------------------+
+ | :class:`struct_time` in | seconds since the epoch | :func:`calendar.timegm` |
+ | UTC | | |
+ +-------------------------+-------------------------+-------------------------+
+ | :class:`struct_time` in | seconds since the epoch | :func:`mktime` |
+ | local time | | |
+ +-------------------------+-------------------------+-------------------------+
+
The module defines the following functions and data items:
diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst
index fd84597534..97074204a4 100644
--- a/Doc/library/turtle.rst
+++ b/Doc/library/turtle.rst
@@ -61,7 +61,7 @@ The object-oriented interface uses essentially two+two classes:
The procedural interface provides functions which are derived from the methods
of the classes :class:`Screen` and :class:`Turtle`. They have the same names as
-the corresponding methods. A screen object is automativally created whenever a
+the corresponding methods. A screen object is automatically created whenever a
function derived from a Screen method is called. An (unnamed) turtle object is
automatically created whenever any of the functions derived from a Turtle method
is called.
@@ -1608,7 +1608,7 @@ The public classes of the module :mod:`turtle`
=========== ===========
"polygon" a polygon-tuple, i.e. a tuple of pairs of coordinates
"image" an image (in this form only used internally!)
- "compound" ``None`` (a compund shape has to be constructed using the
+ "compound" ``None`` (a compound shape has to be constructed using the
:meth:`addcomponent` method)
=========== ===========
@@ -1830,7 +1830,7 @@ There is a set of demo scripts in the turtledemo directory located in the
It contains:
-- a set of 15 demo scripts demonstrating differet features of the new module
+- a set of 15 demo scripts demonstrating different features of the new module
:mod:`turtle`
- a demo viewer :file:`turtleDemo.py` which can be used to view the sourcecode
of the scripts and run them at the same time. 14 of the examples can be
diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst
index 16cfad5b7a..8a74e7d3db 100644
--- a/Doc/library/xml.dom.rst
+++ b/Doc/library/xml.dom.rst
@@ -611,7 +611,7 @@ of that class.
Same as equivalent method in the :class:`Document` class.
-.. method:: Element.getElementsByTagNameNS(tagName)
+.. method:: Element.getElementsByTagNameNS(namespaceURI, localName)
Same as equivalent method in the :class:`Document` class.