Devil merge!

Merged revisions 66561,66564,66580,66610,66614,66618,66624-66625,66628-66629,66643,66645,66660-66665 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66561 | benjamin.peterson | 2008-09-22 17:13:29 -0500 (Mon, 22 Sep 2008) | 1 line

  clean up docs for platform's linux_distribution and dist functions
........
  r66564 | benjamin.peterson | 2008-09-23 08:32:46 -0500 (Tue, 23 Sep 2008) | 1 line

  mention how to override boolean evaluation
........
  r66580 | georg.brandl | 2008-09-24 04:47:55 -0500 (Wed, 24 Sep 2008) | 2 lines

  Indentation normalization.
........
  r66610 | andrew.kuchling | 2008-09-24 12:27:55 -0500 (Wed, 24 Sep 2008) | 1 line

  Improve wording
........
  r66614 | benjamin.peterson | 2008-09-24 17:11:59 -0500 (Wed, 24 Sep 2008) | 4 lines

  #3950 fix missing scale factors in turtle.py

  reviewers: Georg, Benjamin
........
  r66618 | benjamin.peterson | 2008-09-25 15:35:45 -0500 (Thu, 25 Sep 2008) | 1 line

  add a NEWs entry for r66614
........
  r66624 | raymond.hettinger | 2008-09-25 18:31:52 -0500 (Thu, 25 Sep 2008) | 1 line

  Fix namedtuple bug reported by Glenn Linderman.  Template did not form correctly if the field names were input in Unicode.
........
  r66625 | benjamin.peterson | 2008-09-25 21:58:36 -0500 (Thu, 25 Sep 2008) | 1 line

  add the beginnings of a C-API 2 -> 3 porting guide
........
  r66628 | benjamin.peterson | 2008-09-26 15:52:06 -0500 (Fri, 26 Sep 2008) | 1 line

  add an 'other options' section
........
  r66629 | georg.brandl | 2008-09-26 16:15:21 -0500 (Fri, 26 Sep 2008) | 2 lines

  typos.
........
  r66643 | andrew.kuchling | 2008-09-27 09:12:33 -0500 (Sat, 27 Sep 2008) | 1 line

  Add a last bunch of items
........
  r66645 | benjamin.peterson | 2008-09-27 11:23:55 -0500 (Sat, 27 Sep 2008) | 1 line

  2to3's api should be considered unstable
........
  r66660 | andrew.kuchling | 2008-09-27 17:54:08 -0500 (Sat, 27 Sep 2008) | 1 line

  #3510: future-proof text
........
  r66661 | benjamin.peterson | 2008-09-27 18:28:43 -0500 (Sat, 27 Sep 2008) | 1 line

  clarify a few things
........
  r66662 | andrew.kuchling | 2008-09-27 19:15:27 -0500 (Sat, 27 Sep 2008) | 1 line

  #1579477: mention necessity to flush output before exec'ing
........
  r66663 | andrew.kuchling | 2008-09-27 20:08:47 -0500 (Sat, 27 Sep 2008) | 1 line

  #1415508: Document two functions
........
  r66664 | benjamin.peterson | 2008-09-27 20:51:36 -0500 (Sat, 27 Sep 2008) | 1 line

  better grammar
........
  r66665 | benjamin.peterson | 2008-09-27 20:53:29 -0500 (Sat, 27 Sep 2008) | 1 line

  note the 2to3 -d could be useful for other refactoring
........
diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst
index 8040124..2e9547c 100644
--- a/Doc/library/2to3.rst
+++ b/Doc/library/2to3.rst
@@ -74,7 +74,9 @@
 have compliant 3.x code.
 
 2to3 can also refactor doctests.  To enable this mode, use the :option:`-d`
-flag.  Note that *only* doctests will be refactored.
+flag.  Note that *only* doctests will be refactored.  This also doesn't require
+the module to be valid Python.  For example, doctest like examples in a reST
+document could also be refactored with this option.
 
 The :option:`-v` option enables the output of more information on the
 translation process.
@@ -95,4 +97,10 @@
 .. moduleauthor:: Guido van Rossum
 .. moduleauthor:: Collin Winter
 
+
+.. warning::
+
+   The :mod:`lib2to3` API should be considered unstable and may change
+   drastically in the future.
+
 .. XXX What is the public interface anyway?
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index 4eaa690..b67d724 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -370,9 +370,9 @@
             
          def default(self, o):
             try:
-               iterable = iter(o)
+                iterable = iter(o)
             except TypeError:
-               pass
+                pass
             else:
                 return list(iterable)
             return JSONEncoder.default(self, o)
diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst
index de1a116..4936e7d 100644
--- a/Doc/library/optparse.rst
+++ b/Doc/library/optparse.rst
@@ -1193,17 +1193,32 @@
 Querying and manipulating your option parser
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Sometimes, it's useful to poke around your option parser and see what's there.
-OptionParser provides a couple of methods to help you out:
+The default behavior of the option parser can be customized slightly,
+and you can also poke around your option parser and see what's there.
+OptionParser provides several methods to help you out:
 
-``has_option(opt_str)``
-   Return true if the OptionParser has an option with  option string ``opt_str``
-   (e.g., ``"-q"`` or ``"--verbose"``).
+``disable_interspersed_args()``
+  Set parsing to stop on the first non-option. Use this if you have a
+  command processor which runs another command which has options of
+  its own and you want to make sure these options don't get
+  confused. For example, each command might have a different
+  set of options.
+
+``enable_interspersed_args()``
+  Set parsing to not stop on the first non-option, allowing
+  interspersing switches with command arguments.  For example,
+  ``"-s arg1 --long arg2"`` would return ``["arg1", "arg2"]``
+  as the command arguments and ``-s, --long`` as options.
+  This is the default behavior.
 
 ``get_option(opt_str)``
    Returns the Option instance with the option string ``opt_str``, or ``None`` if
    no options have that option string.
 
+``has_option(opt_str)``
+   Return true if the OptionParser has an option with option string ``opt_str``
+   (e.g., ``"-q"`` or ``"--verbose"``).
+
 ``remove_option(opt_str)``
    If the OptionParser has an option corresponding to ``opt_str``, that option is
    removed.  If that option provided any other option strings, all of those option
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 221596c..9e14003 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1215,7 +1215,13 @@
    These functions all execute a new program, replacing the current process; they
    do not return.  On Unix, the new executable is loaded into the current process,
    and will have the same process id as the caller.  Errors will be reported as
-   :exc:`OSError` exceptions.
+   :exc:`OSError` exceptions.  
+
+   The current process is replaced immediately. Open file objects and
+   descriptors are not flushed, so if there may be data buffered
+   on these open files, you should flush them using
+   :func:`sys.stdout.flush` or :func:`os.fsync` before calling an
+   :func:`exec\*` function.
 
    The "l" and "v" variants of the :func:`exec\*` functions differ in how
    command-line arguments are passed.  The "l" variants are perhaps the easiest
@@ -1241,8 +1247,9 @@
    used to define the environment variables for the new process (these are used
    instead of the current process' environment); the functions :func:`execl`,
    :func:`execlp`, :func:`execv`, and :func:`execvp` all cause the new process to
-   inherit the environment of the current process. Availability: Unix,
-   Windows.
+   inherit the environment of the current process. 
+
+   Availability: Unix, Windows.
 
 
 .. function:: _exit(n)
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst
index 22ac72d..3d5228a 100644
--- a/Doc/library/platform.rst
+++ b/Doc/library/platform.rst
@@ -226,29 +226,23 @@
 
 .. function:: dist(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...))
 
-   Tries to determine the name of the OS distribution name Returns a tuple
-   ``(distname, version, id)`` which defaults to the args given as parameters.
-
-   ``supported_dists`` may be given to define the set of Linux
-   distributions to look for. It defaults to a list of currently
-   supported Linux distributions identified by their release file
-   name.
+   This is another name for :func:`linux_distribution`.
 
 .. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1)
 
    Tries to determine the name of the Linux OS distribution name.
 
-   ``supported_dists`` may be given to define the set of Linux
-   distributions to look for. It defaults to a list of currently
-   supported Linux distributions identified by their release file
-   name.
+   ``supported_dists`` may be given to define the set of Linux distributions to
+   look for. It defaults to a list of currently supported Linux distributions
+   identified by their release file name.
 
-   If ``full_distribution_name`` is true (default), the full
-   distribution read from the OS is returned. Otherwise the short name
-   taken from ``supported_dists`` is used.
+   If ``full_distribution_name`` is true (default), the full distribution read
+   from the OS is returned. Otherwise the short name taken from
+   ``supported_dists`` is used.
 
-   Returns a tuple ``(distname,version,id)`` which defaults to the
-   args given as parameters.
+   Returns a tuple ``(distname,version,id)`` which defaults to the args given as
+   parameters.  ``id`` is the item in parentheses after the version number.  It
+   is usually the version codename.
 
 .. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048)
 
diff --git a/Doc/library/site.rst b/Doc/library/site.rst
index 73ec7bf..0fe63a3 100644
--- a/Doc/library/site.rst
+++ b/Doc/library/site.rst
@@ -59,10 +59,11 @@
 
    bar
 
-Then the following directories are added to ``sys.path``, in this order::
+Then the following version-specific directories are added to
+``sys.path``, in this order::
 
-   /usr/local/lib/python3.0/site-packages/bar
-   /usr/local/lib/python3.0/site-packages/foo
+   /usr/local/lib/pythonX.Y/site-packages/bar
+   /usr/local/lib/pythonX.Y/site-packages/foo
 
 Note that :file:`bletch` is omitted because it doesn't exist; the :file:`bar`
 directory precedes the :file:`foo` directory because :file:`bar.pth` comes
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 8f78498..620d08e 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -207,18 +207,18 @@
 .. function:: getaddrinfo(host, port[, family[, socktype[, proto[, flags]]]])
 
    Resolves the *host*/*port* argument, into a sequence of 5-tuples that contain
-   all the necessary argument for the sockets manipulation. *host* is a domain
-   name, a string representation of IPv4/v6 address or ``None``. *port* is a string
-   service name (like ``'http'``), a numeric port number or ``None``.
+   all the necessary arguments for creating the corresponding socket. *host* is a domain
+   name, a string representation of an IPv4/v6 address or ``None``. *port* is a string
+   service name such as ``'http'``, a numeric port number or ``None``.
+   The rest of the arguments are optional and must be numeric if specified.  
+   By passing ``None`` as the value of *host* and *port*, , you can pass ``NULL`` to the C API.
 
-   The rest of the arguments are optional and must be numeric if specified.  For
-   *host* and *port*, by passing ``None``, you can pass ``NULL`` to the C API.
    The :func:`getaddrinfo` function returns a list of 5-tuples with the following
    structure:
 
    ``(family, socktype, proto, canonname, sockaddr)``
 
-   *family*, *socktype*, *proto* are all integer and are meant to be passed to the
+   *family*, *socktype*, *proto* are all integers and are meant to be passed to the
    :func:`socket` function. *canonname* is a string representing the canonical name
    of the *host*. It can be a numeric IPv4/v6 address when :const:`AI_CANONNAME` is
    specified for a numeric *host*. *sockaddr* is a tuple describing a socket
@@ -230,7 +230,7 @@
 
    Return a fully qualified domain name for *name*. If *name* is omitted or empty,
    it is interpreted as the local host.  To find the fully qualified name, the
-   hostname returned by :func:`gethostbyaddr` is checked, then aliases for the
+   hostname returned by :func:`gethostbyaddr` is checked, followed by aliases for the
    host, if available.  The first name which includes a period is selected.  In
    case no fully qualified domain name is available, the hostname as returned by
    :func:`gethostname` is returned.