Commit 4c86cb31 authored by Georg Brandl's avatar Georg Brandl

Merged revisions...

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.
........
parent d4e7addd
......@@ -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.
......
......@@ -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)
......
......@@ -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?
......
......@@ -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 |
+-----------------+--------------------------------+--------------------------------+
......
......@@ -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
......
......@@ -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.
......
......@@ -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]])
......
......@@ -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
......
......@@ -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:
......
.. _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.
......@@ -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::
......
......@@ -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'
......
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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::
......
......@@ -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
......
......@@ -31,7 +31,7 @@ target platform. Forget about the posix module for now -- simply take
it out of the config.c file.
Bang on it until you get a >>> prompt. (You may have to disable the
importing of "site.py" by passing the -S options.)
importing of "site.py" by passing the -S option.)
Then bang on it until it executes very simple Python statements.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment