summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-09 21:04:33 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-09 21:04:33 (GMT)
commite0124bd9c3d3af4bd36d9977e0f76da2cf8a1412 (patch)
treebbbe42587affafea03e122d87aadbbf570e1b820 /Doc
parent07c0a7579b8e578d78882e8a33d6bea76025304f (diff)
downloadcpython-e0124bd9c3d3af4bd36d9977e0f76da2cf8a1412.zip
cpython-e0124bd9c3d3af4bd36d9977e0f76da2cf8a1412.tar.gz
cpython-e0124bd9c3d3af4bd36d9977e0f76da2cf8a1412.tar.bz2
Merged revisions 69998-69999,70002,70022-70023,70025-70026,70061,70086,70145,70171,70183,70188,70235,70244,70275,70281 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r69998 | benjamin.peterson | 2009-02-26 13:04:40 -0600 (Thu, 26 Feb 2009) | 1 line the startship is rather outdated now ........ r69999 | benjamin.peterson | 2009-02-26 13:05:59 -0600 (Thu, 26 Feb 2009) | 1 line comma ........ r70002 | andrew.kuchling | 2009-02-26 16:34:30 -0600 (Thu, 26 Feb 2009) | 1 line The curses panel library is now supported ........ r70022 | georg.brandl | 2009-02-27 10:23:18 -0600 (Fri, 27 Feb 2009) | 1 line #5361: fix typo. ........ r70023 | georg.brandl | 2009-02-27 10:39:26 -0600 (Fri, 27 Feb 2009) | 1 line #5363: fix cmpfiles() docs. Another instance where a prose description is twice as long as the code. ........ r70025 | georg.brandl | 2009-02-27 10:52:55 -0600 (Fri, 27 Feb 2009) | 1 line #5344: fix punctuation. ........ r70026 | georg.brandl | 2009-02-27 10:59:03 -0600 (Fri, 27 Feb 2009) | 1 line #5365: add quick look conversion table for different time representations. ........ r70061 | hirokazu.yamamoto | 2009-02-28 09:24:00 -0600 (Sat, 28 Feb 2009) | 1 line Binary flag is needed on windows. ........ r70086 | benjamin.peterson | 2009-03-01 21:35:12 -0600 (Sun, 01 Mar 2009) | 1 line fix a silly problem of caching gone wrong #5401 ........ r70145 | benjamin.peterson | 2009-03-03 16:51:57 -0600 (Tue, 03 Mar 2009) | 1 line making the writing more formal ........ r70171 | facundo.batista | 2009-03-04 15:18:17 -0600 (Wed, 04 Mar 2009) | 3 lines Fixed a typo. ........ r70183 | benjamin.peterson | 2009-03-04 18:17:57 -0600 (Wed, 04 Mar 2009) | 1 line add example ........ r70188 | hirokazu.yamamoto | 2009-03-05 03:34:14 -0600 (Thu, 05 Mar 2009) | 1 line Fixed memory leak on failure. ........ r70235 | benjamin.peterson | 2009-03-07 18:21:17 -0600 (Sat, 07 Mar 2009) | 1 line fix funky indentation ........ r70244 | martin.v.loewis | 2009-03-08 09:06:19 -0500 (Sun, 08 Mar 2009) | 2 lines Add Chris Withers. ........ r70275 | georg.brandl | 2009-03-09 11:35:48 -0500 (Mon, 09 Mar 2009) | 2 lines Add missing space. ........ r70281 | benjamin.peterson | 2009-03-09 15:38:56 -0500 (Mon, 09 Mar 2009) | 1 line gzip and bz2 are context managers ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/howto/curses.rst2
-rw-r--r--Doc/library/bz2.rst5
-rw-r--r--Doc/library/filecmp.rst25
-rw-r--r--Doc/library/gzip.rst7
-rw-r--r--Doc/library/mmap.rst4
-rw-r--r--Doc/library/stdtypes.rst2
-rw-r--r--Doc/library/struct.rst2
-rw-r--r--Doc/library/symtable.rst6
-rw-r--r--Doc/library/time.rst19
-rw-r--r--Doc/whatsnew/2.6.rst2
10 files changed, 58 insertions, 16 deletions
diff --git a/Doc/howto/curses.rst b/Doc/howto/curses.rst
index 1c191ad..53ef7de 100644
--- a/Doc/howto/curses.rst
+++ b/Doc/howto/curses.rst
@@ -426,7 +426,7 @@ quirks, and provide complete lists of all the functions, attributes, and
Because the curses API is so large, some functions aren't supported in the
Python interface, not because they're difficult to implement, but because no one
has needed them yet. Feel free to add them and then submit a patch. Also, we
-don't yet have support for the menus or panels libraries associated with
+don't yet have support for the menu library associated with
ncurses; feel free to add that.
If you write an interesting little program, feel free to contribute it as
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index cde5749..4808b47 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -58,6 +58,11 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
reading. Instances support iteration in the same way as normal :class:`file`
instances.
+ :class:`BZ2File` supports the :keyword:`with` statement.
+
+ .. versionchanged:: 2.7
+ Support for the :keyword:`with` statement was added.
+
.. method:: close()
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst
index 3377d97..11d74ba 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/gzip.rst b/Doc/library/gzip.rst
index fa73bba..c76bae8 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -53,7 +53,7 @@ The module defines the following items:
``9`` is slowest and produces the most compression. The default is ``9``.
The *mtime* argument is an optional numeric timestamp to be written to
- the stream when compressing. All :program:`gzip`compressed streams are
+ the stream when compressing. All :program:`gzip` compressed streams are
required to contain a timestamp. If omitted or ``None``, the current
time is used. This module ignores the timestamp when decompressing;
however, some programs, such as :program:`gunzip`\ , make use of it.
@@ -67,6 +67,11 @@ The module defines the following items:
writing as *fileobj*, and retrieve the resulting memory buffer using the
:class:`StringIO` object's :meth:`getvalue` method.
+ :class:`GzipFile` supports the :keyword:`with` statement.
+
+ .. versionchanged:: 2.7
+ Support for the :keyword:`with` statement was added.
+
.. function:: open(filename[, mode[, compresslevel]])
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index e85a964..ceca29a 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -93,10 +93,10 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
import mmap
# write a simple example file
- with open("hello.txt", "w") as f:
+ with open("hello.txt", "wb") as f:
f.write("Hello Python!\n")
- with open("hello.txt", "r+") as f:
+ with open("hello.txt", "r+b") as f:
# memory-map the file, size 0 means whole file
map = mmap.mmap(f.fileno(), 0)
# read content via standard file methods
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index eea7364..ec2fe96 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1247,7 +1247,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/struct.rst b/Doc/library/struct.rst
index 7802fdb..bd8a7a9 100644
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -48,7 +48,7 @@ The module defines the following exception and functions:
.. function:: unpack_from(fmt, buffer[,offset=0])
- Unpack the *buffer* according to tthe given format. The result is a tuple even
+ Unpack the *buffer* according to the given format. The result is a tuple even
if it contains exactly one item. The *buffer* must contain at least the amount
of data required by the format (``len(buffer[offset:])`` must be at least
``calcsize(fmt)``).
diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst
index 28306e6..9ea3f01 100644
--- a/Doc/library/symtable.rst
+++ b/Doc/library/symtable.rst
@@ -164,6 +164,12 @@ Examining Symbol Tables
If the name is used as the target of a function or class statement, this
will be true.
+ For example::
+
+ >>> table = symtable.symtable("def some_func(): pass", "string", "exec")
+ >>> table.lookup("some_func").is_namespace()
+ True
+
Note that a single name can be bound to multiple objects. If the result
is ``True``, the name may also be bound to other objects, like an int or
list, that does not introduce a new namespace.
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 0e82b7d..46d972a 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -114,6 +114,25 @@ An explanation of some terminology and conventions is in order.
:class:`struct_time`, or having elements of the wrong type, a :exc:`TypeError`
is raised.
+* 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/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 6517609..f0e9eb4 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -274,7 +274,7 @@ structure is::
The expression is evaluated, and it should result in an object that supports the
context management protocol (that is, has :meth:`__enter__` and :meth:`__exit__`
-methods.
+methods).
The object's :meth:`__enter__` is called before *with-block* is executed and
therefore can run set-up code. It also may return a value that is bound to the