diff options
author | Georg Brandl <georg@python.org> | 2010-03-21 19:34:26 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-03-21 19:34:26 (GMT) |
commit | 4c86cb31e2808ad47e6780a4a1bf3a15ec0d4b2e (patch) | |
tree | dd304b6830edc24aa1c690840ea49f1b0a8d9f33 /Doc | |
parent | d4e7addd11b586576f98129fe83d21cab173e181 (diff) | |
download | cpython-4c86cb31e2808ad47e6780a4a1bf3a15ec0d4b2e.zip cpython-4c86cb31e2808ad47e6780a4a1bf3a15ec0d4b2e.tar.gz cpython-4c86cb31e2808ad47e6780a4a1bf3a15ec0d4b2e.tar.bz2 |
Merged revisions 78859-78860,78952,79168-79169,79173,79176,79178-79179,79181,79184-79185,79192,79212 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78859 | georg.brandl | 2010-03-12 10:57:43 +0100 (Fr, 12 Mär 2010) | 1 line
Get rid of backticks.
........
r78860 | georg.brandl | 2010-03-12 11:02:03 +0100 (Fr, 12 Mär 2010) | 1 line
Fix warnings from "make check".
........
r78952 | georg.brandl | 2010-03-14 10:55:08 +0100 (So, 14 Mär 2010) | 1 line
#8137: add iso-8859-16 to the standard encodings table.
........
r79168 | georg.brandl | 2010-03-21 10:01:27 +0100 (So, 21 Mär 2010) | 1 line
Fix some issues found by Jacques Ducasse on the docs list.
........
r79169 | georg.brandl | 2010-03-21 10:02:01 +0100 (So, 21 Mär 2010) | 1 line
Remove the "built-in objects" file. It only contained two paragraphs of which only one contained useful information, which belongs in the ref manual however.
........
r79173 | georg.brandl | 2010-03-21 10:09:38 +0100 (So, 21 Mär 2010) | 1 line
Document that GzipFile supports iteration.
........
r79176 | georg.brandl | 2010-03-21 10:17:41 +0100 (So, 21 Mär 2010) | 1 line
Introduce copy by slicing, used in later chapters.
........
r79178 | georg.brandl | 2010-03-21 10:28:16 +0100 (So, 21 Mär 2010) | 1 line
Clarify that for shell=True, the shell PID will be the child PID.
........
r79179 | georg.brandl | 2010-03-21 10:37:54 +0100 (So, 21 Mär 2010) | 1 line
Mention inefficiency of lists as queues, add link to collections.deque discussion.
........
r79181 | georg.brandl | 2010-03-21 10:51:16 +0100 (So, 21 Mär 2010) | 1 line
Update os.kill() emulation example for Windows to use ctypes.
........
r79184 | georg.brandl | 2010-03-21 10:58:36 +0100 (So, 21 Mär 2010) | 1 line
Update text for newest US DST regulation. The sample file already has the calculation right.
........
r79185 | georg.brandl | 2010-03-21 11:02:47 +0100 (So, 21 Mär 2010) | 1 line
Include structmember.h correctly.
........
r79192 | georg.brandl | 2010-03-21 12:50:58 +0100 (So, 21 Mär 2010) | 1 line
Remove leftover word.
........
r79212 | georg.brandl | 2010-03-21 20:01:38 +0100 (So, 21 Mär 2010) | 1 line
Fix plural.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/extending/newtypes.rst | 2 | ||||
-rw-r--r-- | Doc/faq/library.rst | 2 | ||||
-rw-r--r-- | Doc/faq/windows.rst | 10 | ||||
-rw-r--r-- | Doc/library/codecs.rst | 6 | ||||
-rw-r--r-- | Doc/library/datetime.rst | 4 | ||||
-rw-r--r-- | Doc/library/functions.rst | 5 | ||||
-rw-r--r-- | Doc/library/gzip.rst | 1 | ||||
-rw-r--r-- | Doc/library/index.rst | 1 | ||||
-rw-r--r-- | Doc/library/logging.rst | 8 | ||||
-rw-r--r-- | Doc/library/objects.rst | 27 | ||||
-rw-r--r-- | Doc/library/pdb.rst | 2 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 12 | ||||
-rw-r--r-- | Doc/library/subprocess.rst | 3 | ||||
-rw-r--r-- | Doc/library/sys.rst | 2 | ||||
-rw-r--r-- | Doc/tutorial/datastructures.rst | 5 | ||||
-rw-r--r-- | Doc/tutorial/introduction.rst | 6 | ||||
-rw-r--r-- | Doc/whatsnew/2.2.rst | 2 |
17 files changed, 45 insertions, 53 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index e3cf66a..ba79260 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -252,7 +252,7 @@ This version of the module has a number of changes. We've added an extra include:: - #include "structmember.h" + #include <structmember.h> This include provides declarations that we use to handle attributes, as described a bit later. diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst index 9c458da..4b0c3d3 100644 --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -205,7 +205,7 @@ without curses:: while 1: try: c = sys.stdin.read(1) - print "Got character", `c` + print "Got character", repr(c) except IOError: pass finally: termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm) diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index 2d701c8..353c400 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -441,13 +441,15 @@ present, and ``getch()`` which gets one character without echoing it. How do I emulate os.kill() in Windows? -------------------------------------- -Use win32api:: +To terminate a process, you can use ctypes:: + + import ctypes def kill(pid): """kill function for Win32""" - import win32api - handle = win32api.OpenProcess(1, 0, pid) - return (0 != win32api.TerminateProcess(handle, 0)) + kernel32 = ctypes.windll.kernel32 + handle = kernel32.OpenProcess(1, 0, pid) + return (0 != kernel32.TerminateProcess(handle, 0)) Why does os.path.isdir() fail on NT shared directories? diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index d3b1025..d966262 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -1035,11 +1035,13 @@ particular, the following variants typically exist: +-----------------+--------------------------------+--------------------------------+ | iso8859_10 | iso-8859-10, latin6, L6 | Nordic languages | +-----------------+--------------------------------+--------------------------------+ -| iso8859_13 | iso-8859-13 | Baltic languages | +| iso8859_13 | iso-8859-13, latin7, L7 | Baltic languages | +-----------------+--------------------------------+--------------------------------+ | iso8859_14 | iso-8859-14, latin8, L8 | Celtic languages | +-----------------+--------------------------------+--------------------------------+ -| iso8859_15 | iso-8859-15 | Western Europe | +| iso8859_15 | iso-8859-15, latin9, L9 | Western Europe | ++-----------------+--------------------------------+--------------------------------+ +| iso8859_16 | iso-8859-16, latin10, L10 | South-Eastern Europe | +-----------------+--------------------------------+--------------------------------+ | johab | cp1361, ms1361 | Korean | +-----------------+--------------------------------+--------------------------------+ diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index aeb0d58..e8fe81b 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1445,8 +1445,8 @@ Example :class:`tzinfo` classes: Note that there are unavoidable subtleties twice per year in a :class:`tzinfo` subclass accounting for both standard and daylight time, at the DST transition points. For concreteness, consider US Eastern (UTC -0500), where EDT begins the -minute after 1:59 (EST) on the first Sunday in April, and ends the minute after -1:59 (EDT) on the last Sunday in October:: +minute after 1:59 (EST) on the second Sunday in March, and ends the minute after +1:59 (EDT) on the first Sunday in November:: UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 6e8f507..e5df766 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -336,7 +336,7 @@ available. They are listed here in alphabetical order. This function can also be used to execute arbitrary code objects (such as those created by :func:`compile`). In this case pass a code object instead of a string. If the code object has been compiled with ``'exec'`` as the - *kind* argument, :func:`eval`\'s return value will be ``None``. + *mode* argument, :func:`eval`\'s return value will be ``None``. Hints: dynamic execution of statements is supported by the :keyword:`exec` statement. Execution of statements from a file is supported by the @@ -1135,7 +1135,8 @@ available. They are listed here in alphabetical order. value is ``None``. *key* specifies a function of one argument that is used to extract a comparison - key from each list element: ``key=str.lower``. The default value is ``None``. + key from each list element: ``key=str.lower``. The default value is ``None`` + (compare the elements directly). *reverse* is a boolean value. If set to ``True``, then the list elements are sorted as if each comparison were reversed. diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index c6f9ef8..3493162 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -58,6 +58,7 @@ 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 iteration. .. function:: open(filename[, mode[, compresslevel]]) diff --git a/Doc/library/index.rst b/Doc/library/index.rst index f25724c..5d860f8 100644 --- a/Doc/library/index.rst +++ b/Doc/library/index.rst @@ -43,7 +43,6 @@ the `Python Package Index <http://pypi.python.org/pypi>`_. intro.rst functions.rst constants.rst - objects.rst stdtypes.rst exceptions.rst diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 6d3e42b..289cff8 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -1210,12 +1210,12 @@ swallowed. Other exceptions which occur during the :meth:`emit` method of a :class:`Handler` subclass are passed to its :meth:`handleError` method. The default implementation of :meth:`handleError` in :class:`Handler` checks -to see if a module-level variable, `raiseExceptions`, is set. If set, a -traceback is printed to `sys.stderr`. If not set, the exception is swallowed. +to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a +traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed. -**Note:** The default value of `raiseExceptions` is `True`. This is because +**Note:** The default value of :data:`raiseExceptions` is ``True``. This is because during development, you typically want to be notified of any exceptions that -occur. It's advised that you set `raiseExceptions` to `False` for production +occur. It's advised that you set :data:`raiseExceptions` to ``False`` for production usage. .. _context-info: diff --git a/Doc/library/objects.rst b/Doc/library/objects.rst deleted file mode 100644 index 1b75161..0000000 --- a/Doc/library/objects.rst +++ /dev/null @@ -1,27 +0,0 @@ - -.. _builtin: - -**************** -Built-in Objects -**************** - -.. index:: - pair: built-in; types - pair: built-in; exceptions - pair: built-in; functions - pair: built-in; constants - single: symbol table - -Names for built-in exceptions and functions and a number of constants are found -in a separate symbol table. This table is searched last when the interpreter -looks up the meaning of a name, so local and global user-defined names can -override built-in names. Built-in types are described together here for easy -reference. - -The tables in this chapter document the priorities of operators by listing them -in order of ascending priority (within a table) and grouping operators that have -the same priority in the same box. Binary operators of the same priority group -from left to right. (Unary operators group from right to left, but there you -have no real choice.) See :ref:`operator-summary` for the complete picture on -operator priorities. - diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 060b743..7f2197e 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -23,7 +23,7 @@ supports post-mortem debugging and can be called under program control. The debugger is extensible --- it is actually defined as the class :class:`Pdb`. This is currently undocumented but easily understood by reading the source. The -extension interface uses the modules :mod:`bdb` (undocumented) and :mod:`cmd`. +extension interface uses the modules :mod:`bdb` and :mod:`cmd`. The debugger's prompt is ``(Pdb)``. Typical usage to run a program under control of the debugger is:: diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 18930ef..2d830d2 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -883,12 +883,12 @@ string functions based on regular expressions. .. method:: str.format(*args, **kwargs) - Perform a string formatting operation. The *format_string* argument can - contain literal text or replacement fields delimited by braces ``{}``. Each - replacement field contains either the numeric index of a positional argument, - or the name of a keyword argument. Returns a copy of *format_string* where - each replacement field is replaced with the string value of the corresponding - argument. + Perform a string formatting operation. The string on which this method is + called can contain literal text or replacement fields delimited by braces + ``{}``. Each replacement field contains either the numeric index of a + positional argument, or the name of a keyword argument. Returns a copy of + the string where each replacement field is replaced with the string value of + the corresponding argument. >>> "The sum of 1 + 2 is {0}".format(1+2) 'The sum of 1 + 2 is 3' diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 30b095a..805f3ac 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -339,6 +339,9 @@ The following attributes are also available: The process ID of the child process. + Note that if you set the *shell* argument to ``True``, this is the process ID + of the spawned shell. + .. attribute:: Popen.returncode diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 7041dd4..b8fe702 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -405,7 +405,7 @@ always available. specific. If given, *default* will be returned if the object does not provide means to - retrieve the size. Otherwise a `TypeError` will be raised. + retrieve the size. Otherwise a :exc:`TypeError` will be raised. :func:`getsizeof` calls the object's ``__sizeof__`` method and adds an additional garbage collector overhead if the object is managed by the garbage diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index dfc2b33..2f94885 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -158,6 +158,11 @@ have fast appends and pops from both ends. For example:: >>> queue # Remaining queue in order of arrival deque(['Michael', 'Terry', 'Graham']) +However, since lists are implemented as an array of elements, they are not the +optimal data structure to use as a queue (the ``pop(0)`` needs to move all +following elements). See :ref:`tut-list-tools` for a look at +:class:`collections.deque`, which is designed to work efficiently as a queue. + .. _tut-functional: diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index 1d67ed3..c953394 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -523,6 +523,12 @@ concatenated and so on:: >>> 3*a[:3] + ['Boo!'] ['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!'] +All slice operations return a new list containing the requested elements. This +means that the following slice returns a shallow copy of the list *a*:: + + >>> a[:] + ['spam', 'eggs', 100, 1234] + Unlike strings, which are *immutable*, it is possible to change individual elements of a list:: diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst index 31e8dd0..89e4d76 100644 --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -30,7 +30,7 @@ understand the complete implementation and design rationale for a change, refer to the PEP for a particular new feature. -.. seealso (now defunct) +.. see also, now defunct http://www.unixreview.com/documents/s=1356/urm0109h/0109h.htm "What's So Special About Python 2.2?" is also about the new 2.2 features, and |