]> granicus.if.org Git - python/commitdiff
Merged revisions 68582,68718,68720-68721,68724-68727,68859,68973,69288-69289,69293...
authorGeorg Brandl <georg@python.org>
Mon, 23 Feb 2009 10:41:11 +0000 (10:41 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 23 Feb 2009 10:41:11 +0000 (10:41 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68582 | georg.brandl | 2009-01-13 23:14:01 +0100 (Di, 13 Jan 2009) | 2 lines

  Use assertRaises.
........
  r68718 | georg.brandl | 2009-01-18 11:42:35 +0100 (So, 18 Jan 2009) | 1 line

  #4976: union() and intersection() take multiple args, but talk about "the other".
........
  r68720 | georg.brandl | 2009-01-18 11:45:22 +0100 (So, 18 Jan 2009) | 1 line

  #4974: fix redundant mention of lists and tuples.
........
  r68721 | georg.brandl | 2009-01-18 11:48:16 +0100 (So, 18 Jan 2009) | 1 line

  #4914: trunc is in math.
........
  r68724 | georg.brandl | 2009-01-18 14:24:10 +0100 (So, 18 Jan 2009) | 1 line

  #4979: correct result range for some random functions.
........
  r68725 | georg.brandl | 2009-01-18 14:47:26 +0100 (So, 18 Jan 2009) | 1 line

  #4857: fix augmented assignment target spec.
........
  r68726 | georg.brandl | 2009-01-18 15:41:52 +0100 (So, 18 Jan 2009) | 1 line

  #4923: clarify what was added.
........
  r68727 | georg.brandl | 2009-01-18 19:25:30 +0100 (So, 18 Jan 2009) | 1 line

  #4986: augassigns are not expressions.
........
  r68859 | georg.brandl | 2009-01-22 19:29:28 +0100 (Do, 22 Jan 2009) | 2 lines

  Clarify wording.
........
  r68973 | georg.brandl | 2009-01-26 22:29:38 +0100 (Mo, 26 Jan 2009) | 2 lines

  Copy over docs on advanced role features from Sphinx docs.
........
  r69288 | georg.brandl | 2009-02-05 11:30:57 +0100 (Do, 05 Feb 2009) | 1 line

  #5153: fix typo in example.
........
  r69289 | georg.brandl | 2009-02-05 11:37:07 +0100 (Do, 05 Feb 2009) | 1 line

  #5144: document that PySys_SetArgv prepends the script directory (or the empty string) to sys.path.
........
  r69293 | georg.brandl | 2009-02-05 11:59:28 +0100 (Do, 05 Feb 2009) | 1 line

  #5059: fix example.
........
  r69295 | georg.brandl | 2009-02-05 12:23:47 +0100 (Do, 05 Feb 2009) | 1 line

  PyErr_PrintEx is also in 2.x...
........
  r69297 | georg.brandl | 2009-02-05 12:32:18 +0100 (Do, 05 Feb 2009) | 1 line

  #5015: document PythonHome API functions.
........
  r69298 | georg.brandl | 2009-02-05 12:33:21 +0100 (Do, 05 Feb 2009) | 1 line

  #4827: fix callback example.
........
  r69299 | georg.brandl | 2009-02-05 12:35:28 +0100 (Do, 05 Feb 2009) | 1 line

  #4820: use correct module for ctypes.util.
........
  r69300 | georg.brandl | 2009-02-05 12:38:23 +0100 (Do, 05 Feb 2009) | 1 line

  #4563: disable alpha and roman lists, fixes wrong formatting of contributor list.
........
  r69301 | georg.brandl | 2009-02-05 12:40:35 +0100 (Do, 05 Feb 2009) | 1 line

  #5031: fix Thread.daemon property docs.
........
  r69409 | georg.brandl | 2009-02-07 13:21:17 +0100 (Sa, 07 Feb 2009) | 1 line

  #5174: fix wrong file closing in example.
........
  r69414 | georg.brandl | 2009-02-07 19:49:54 +0100 (Sa, 07 Feb 2009) | 1 line

  make "super only for new-style classes" a note.
........
  r69570 | georg.brandl | 2009-02-13 11:40:14 +0100 (Fr, 13 Feb 2009) | 1 line

  #4894: document "newurl" parameter to redirect_request().
........
  r69573 | georg.brandl | 2009-02-13 11:44:17 +0100 (Fr, 13 Feb 2009) | 1 line

  #3734: document complex coercing behavior better.
........
  r69576 | georg.brandl | 2009-02-13 11:56:50 +0100 (Fr, 13 Feb 2009) | 1 line

  #1661108: note that urlsafe encoded string can contain "=".
........
  r69728 | georg.brandl | 2009-02-18 01:22:55 +0100 (Mi, 18 Feb 2009) | 2 lines

  #5297: fix example.
........
  r69729 | georg.brandl | 2009-02-18 01:25:13 +0100 (Mi, 18 Feb 2009) | 2 lines

  #5296: sequence -> iterable.
........
  r69730 | georg.brandl | 2009-02-18 01:31:36 +0100 (Mi, 18 Feb 2009) | 2 lines

  #5268: mention VMSError.
........
  r69769 | georg.brandl | 2009-02-19 09:30:06 +0100 (Do, 19 Feb 2009) | 1 line

  #5310, #3558: fix operator precedence table.
........
  r69776 | georg.brandl | 2009-02-19 17:34:51 +0100 (Do, 19 Feb 2009) | 2 lines

  #5317: update IronPython URL.
........
  r69803 | georg.brandl | 2009-02-20 08:48:21 +0100 (Fr, 20 Feb 2009) | 1 line

  #5327: fix a broken link by joining it.
........
  r69804 | georg.brandl | 2009-02-20 09:22:21 +0100 (Fr, 20 Feb 2009) | 1 line

  At least separate imports from other statements.
........
  r69805 | georg.brandl | 2009-02-20 09:45:47 +0100 (Fr, 20 Feb 2009) | 2 lines

  Fix punctuation.
........
  r69840 | georg.brandl | 2009-02-21 20:09:40 +0100 (Sa, 21 Feb 2009) | 1 line

  #5338, #5339: two types in the API manual.
........
  r69896 | georg.brandl | 2009-02-23 11:24:23 +0100 (Mo, 23 Feb 2009) | 1 line

  #5348: format() converts all kinds of values.
........

30 files changed:
Doc/c-api/exceptions.rst
Doc/c-api/init.rst
Doc/c-api/intro.rst
Doc/c-api/veryhigh.rst
Doc/documenting/markup.rst
Doc/howto/webservers.rst
Doc/library/base64.rst
Doc/library/cgi.rst
Doc/library/cgitb.rst
Doc/library/cookielib.rst
Doc/library/ctypes.rst
Doc/library/datetime.rst
Doc/library/exceptions.rst
Doc/library/functions.rst
Doc/library/optparse.rst
Doc/library/random.rst
Doc/library/socketserver.rst
Doc/library/stdtypes.rst
Doc/library/threading.rst
Doc/library/urllib2.rst
Doc/library/xml.etree.elementtree.rst
Doc/library/xmlrpclib.rst
Doc/reference/datamodel.rst
Doc/reference/expressions.rst
Doc/reference/introduction.rst
Doc/reference/simple_stmts.rst
Doc/tools/rstlint.py
Doc/tools/sphinxext/pyspecific.py
Doc/whatsnew/2.5.rst
Lib/test/test_ast.py

index 536b123af715fb4f8a99bbb94d8d57b622496d85..d3f9135b17a9a96f9a026ec088a6a10fbadc2d98 100644 (file)
@@ -41,12 +41,21 @@ is a separate error indicator for each thread.
    Either alphabetical or some kind of structure.
 
 
-.. cfunction:: void PyErr_Print()
+.. cfunction:: void PyErr_PrintEx(int set_sys_last_vars)
 
    Print a standard traceback to ``sys.stderr`` and clear the error indicator.
    Call this function only when the error indicator is set.  (Otherwise it will
    cause a fatal error!)
 
+   If *set_sys_last_vars* is nonzero, the variables :data:`sys.last_type`,
+   :data:`sys.last_value` and :data:`sys.last_traceback` will be set to the
+   type, value and traceback of the printed exception, respectively.
+
+
+.. cfunction:: void PyErr_Print()
+
+   Alias for ``PyErr_PrintEx(1)``.
+
 
 .. cfunction:: PyObject* PyErr_Occurred()
 
index a4a202ad0a81f22a6d4057839af07586ae81bda1..077efbc57b760a9fdc867f095ba639310addf723 100644 (file)
@@ -353,18 +353,36 @@ Initialization, Finalization, and Threads
       single: Py_FatalError()
       single: argv (in module sys)
 
-   Set ``sys.argv`` based on *argc* and *argv*.  These parameters are similar to
-   those passed to the program's :cfunc:`main` function with the difference that
-   the first entry should refer to the script file to be executed rather than the
-   executable hosting the Python interpreter.  If there isn't a script that will be
-   run, the first entry in *argv* can be an empty string.  If this function fails
-   to initialize ``sys.argv``, a fatal condition is signalled using
-   :cfunc:`Py_FatalError`.
+   Set :data:`sys.argv` based on *argc* and *argv*.  These parameters are
+   similar to those passed to the program's :cfunc:`main` function with the
+   difference that the first entry should refer to the script file to be
+   executed rather than the executable hosting the Python interpreter.  If there
+   isn't a script that will be run, the first entry in *argv* can be an empty
+   string.  If this function fails to initialize :data:`sys.argv`, a fatal
+   condition is signalled using :cfunc:`Py_FatalError`.
+
+   This function also prepends the executed script's path to :data:`sys.path`.
+   If no script is executed (in the case of calling ``python -c`` or just the
+   interactive interpreter), the empty string is used instead.
 
    .. XXX impl. doesn't seem consistent in allowing 0/NULL for the params;
       check w/ Guido.
 
 
+.. cfunction:: void Py_SetPythonHome(char *home)
+
+   Set the default "home" directory, that is, the location of the standard
+   Python libraries.  The libraries are searched in
+   :file:`{home}/lib/python{version}` and :file:`{home}/lib/python{version}`.
+
+
+.. cfunction:: char* Py_GetPythonHome()
+
+   Return the default "home", that is, the value set by a previous call to
+   :cfunc:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME`
+   environment variable if it is set.
+
+
 .. _threads:
 
 Thread State and the Global Interpreter Lock
index 9befaf7a739526ebce18e2e962453b1a1e7a25fd..e8a3fc4851edb862597107eb0df17ff1704181a5 100644 (file)
@@ -187,7 +187,7 @@ caller is said to receive a *new* reference.  When no ownership is transferred,
 the caller is said to *borrow* the reference. Nothing needs to be done for a
 borrowed reference.
 
-Conversely, when a calling function passes it a reference to an  object, there
+Conversely, when a calling function passes in a reference to an  object, there
 are two possibilities: the function *steals* a  reference to the object, or it
 does not.  *Stealing a reference* means that when you pass a reference to a
 function, that function assumes that it now owns that reference, and you are not
index 6a3f91d098038b52691046720030564edbd6ee86..6811bc876a6ccace3e0f2ae104a6a9ff94a8ac89 100644 (file)
@@ -16,7 +16,7 @@ parameter.  The available start symbols are :const:`Py_eval_input`,
 :const:`Py_file_input`, and :const:`Py_single_input`.  These are described
 following the functions which accept them as parameters.
 
-Note also that several of these functions take :ctype:`FILE\*` parameters.  On
+Note also that several of these functions take :ctype:`FILE\*` parameters.  One
 particular issue which needs to be handled carefully is that the :ctype:`FILE`
 structure for different C libraries can be different and incompatible.  Under
 Windows (at least), it is possible for dynamically linked extensions to actually
index 80b43b9850329d375c2f20af2392155e2a3a76c5..3ca8983ee1fdb94722a4465226e05e7b47dec0ce 100644 (file)
@@ -285,14 +285,27 @@ Inline markup
 As said before, Sphinx uses interpreted text roles to insert semantic markup in
 documents.
 
-Variable names are an exception, they should be marked simply with ``*var*``.
+Names of local variables, such as function/method arguments, are an exception,
+they should be marked simply with ``*var*``.
 
 For all other roles, you have to write ``:rolename:`content```.
 
-.. note::
+There are some additional facilities that make cross-referencing roles more
+versatile:
+
+* You may supply an explicit title and reference target, like in reST direct
+  hyperlinks: ``:role:`title <target>``` will refer to *target*, but the link
+  text will be *title*.
+
+* If you prefix the content with ``!``, no reference/hyperlink will be created.
+
+* For the Python object roles, if you prefix the content with ``~``, the link
+  text will only be the last component of the target.  For example,
+  ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only
+  display ``get`` as the link text.
 
-   For all cross-referencing roles, if you prefix the content with ``!``, no
-   reference/hyperlink will be created.
+  In HTML output, the link's ``title`` attribute (that is e.g. shown as a
+  tool-tip on mouse-hover) will always be the full target name.
 
 The following roles refer to objects in modules and are possibly hyperlinked if
 a matching identifier is found:
@@ -310,7 +323,7 @@ a matching identifier is found:
 
 .. describe:: data
 
-   The name of a module-level variable.
+   The name of a module-level variable or constant.
 
 .. describe:: const
 
index 6e0c815c4ef17ec90622aa1d5bbb5ac950c847dc..62c9124c0bf5fe7260c9f97ee8010a8f3b7ef418 100644 (file)
@@ -99,7 +99,8 @@ simple CGI program::
     # -*- coding: UTF-8 -*-
 
     # enable debugging
-    import cgitb; cgitb.enable()
+    import cgitb
+    cgitb.enable()
 
     print "Content-Type: text/plain;charset=utf-8"
     print
index 68a941faf74b09681950b9561356310851ea55b4..084660d66e0b10799f296b83c8df8a99dd587af1 100644 (file)
@@ -63,7 +63,8 @@ The modern interface, which was introduced in Python 2.4, provides:
 .. function:: urlsafe_b64encode(s)
 
    Encode string *s* using a URL-safe alphabet, which substitutes ``-`` instead of
-   ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.
+   ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet.  The result
+   can still contain ``=``.
 
 
 .. function:: urlsafe_b64decode(s)
index 0248284b8722e87e96c6a46fe55456942f67cbb8..3879e0d9f207e0c50e89c1f3af2f44843d83680d 100644 (file)
@@ -67,16 +67,18 @@ Begin by writing ``import cgi``.  Do not use ``from cgi import *`` --- the
 module defines all sorts of names for its own use or for backward compatibility
 that you don't want in your namespace.
 
-When you write a new script, consider adding the line::
+When you write a new script, consider adding these lines::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 This activates a special exception handler that will display detailed reports in
 the Web browser if any errors occur.  If you'd rather not show the guts of your
 program to users of your script, you can have the reports saved to files
-instead, with a line like this::
+instead, with code like this::
 
-   import cgitb; cgitb.enable(display=0, logdir="/tmp")
+   import cgitb
+   cgitb.enable(display=0, logdir="/tmp")
 
 It's very helpful to use this feature during script development. The reports
 produced by :mod:`cgitb` provide information that can save you a lot of time in
@@ -470,9 +472,10 @@ discarded altogether.
 
 Fortunately, once you have managed to get your script to execute *some* code,
 you can easily send tracebacks to the Web browser using the :mod:`cgitb` module.
-If you haven't done so already, just add the line::
+If you haven't done so already, just add the lines::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 to the top of your script.  Then try running it again; when a problem occurs,
 you should see a detailed report that will likely make apparent the cause of the
index 327cd17a257819e5671dabe40c0e890cce17c6d0..052b82153f4c0c29dc1badb5b77b9cc699ef9cc5 100644 (file)
@@ -26,9 +26,10 @@ as well as the values of the arguments and local variables to currently running
 functions, to help you debug the problem.  Optionally, you can save this
 information to a file instead of sending it to the browser.
 
-To enable this feature, simply add one line to the top of your CGI script::
+To enable this feature, simply add this to the top of your CGI script::
 
-   import cgitb; cgitb.enable()
+   import cgitb
+   cgitb.enable()
 
 The options to the :func:`enable` function control whether the report is
 displayed in the browser and whether the report is logged to a file for later
index f55d6c2f065cdbc4f38754b429cb802f8f54d98a..12a12a03ac0f517cb485d9582157498811387d54 100644 (file)
@@ -769,7 +769,7 @@ returned::
    import urllib2
    from cookielib import CookieJar, DefaultCookiePolicy
    policy = DefaultCookiePolicy(
-       rfc2965=True, strict_ns_domain=Policy.DomainStrict,
+       rfc2965=True, strict_ns_domain=DefaultCookiePolicy.DomainStrict,
        blocked_domains=["ads.net", ".ads.net"])
    cj = CookieJar(policy)
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
index 9ff3de053cbb6660a2a0c9cc772e1b78e273d3ff..c7c3b008bddd330a718e4339bb114e5bb31714d8 100644 (file)
@@ -1274,6 +1274,7 @@ library to load.
 
 
 .. data:: find_library(name)
+   :module: ctypes.util
    :noindex:
 
    Try to find a library and return a pathname.  *name* is the library name without
index 637326dfd701d95101afaa5fbe1f7e76ad7723a6..099627647ddb963789abe6bb7969611807eca8bf 100644 (file)
@@ -1497,11 +1497,10 @@ For :class:`date` objects, the format codes for hours, minutes, seconds, and
 microseconds should not be used, as :class:`date` objects have no such
 values.  If they're used anyway, ``0`` is substituted for them.
 
-:class:`time` and :class:`datetime` objects support a ``%f`` format code
-which expands to the number of microseconds in the object, zero-padded on
-the left to six places.
-
 .. versionadded:: 2.6
+   :class:`time` and :class:`datetime` objects support a ``%f`` format code
+   which expands to the number of microseconds in the object, zero-padded on
+   the left to six places.
 
 For a naive object, the ``%z`` and ``%Z`` format codes are replaced by empty
 strings.
@@ -1621,7 +1620,9 @@ Notes:
 (1)
    When used with the :func:`strptime` function, the ``%f`` directive
    accepts from one to six digits and zero pads on the right.  ``%f`` is
-   an extension to the set of format characters in the C standard.
+   an extension to the set of format characters in the C standard (but
+   implemented separately in datetime objects, and therefore always
+   available).
 
 (2)
    When used with the :func:`strptime` function, the ``%p`` directive only affects
index 01b54b3ff369a39015cefa6015323d6ef913a828..9673dab8f14e16774fa6541bed02e742fdc8fd88 100644 (file)
@@ -398,6 +398,11 @@ The following exceptions are the exceptions that are actually raised.
    more precise exception such as :exc:`IndexError`.
 
 
+.. exception:: VMSError
+
+   Only available on VMS.  Raised when a VMS-specific error occurs.
+
+
 .. exception:: WindowsError
 
    Raised when a Windows-specific error occurs or when the error number does not
index 63a2e3e76e34045b5061e71b9f2ffa47010c07cd..7a3132388a83e45df5a6e0cb1fc3209119dd8b73 100644 (file)
@@ -425,6 +425,26 @@ available.  They are listed here in alphabetical order.
 
    The float type is described in :ref:`typesnumeric`.
 
+
+.. function:: format(value[, format_spec])
+
+   .. index::
+      pair: str; format
+      single: __format__
+
+   Convert a *value* to a "formatted" representation, as controlled by
+   *format_spec*.  The interpretation of *format_spec* will depend on the type
+   of the *value* argument, however there is a standard formatting syntax that
+   is used by most built-in types: :ref:`formatspec`.
+
+   .. note::
+
+      ``format(value, format_spec)`` merely calls
+      ``value.__format__(format_spec)``.
+
+   .. versionadded:: 2.6
+
+
 .. function:: frozenset([iterable])
    :noindex:
 
@@ -1178,8 +1198,10 @@ available.  They are listed here in alphabetical order.
    If the second argument is omitted the super
    object returned is unbound.  If the second argument is an object,
    ``isinstance(obj, type)`` must be true.  If the second argument is a type,
-   ``issubclass(type2, type)`` must be true. :func:`super` only works for
-   :term:`new-style class`\es.
+   ``issubclass(type2, type)`` must be true.
+
+   .. note::
+      :func:`super` only works for :term:`new-style class`\es.
 
    There are two typical use cases for "super".  In a class hierarchy with
    single inheritance, "super" can be used to refer to parent classes without
index 6af40745fbce1ed47243aa131b10e51b96724181..4ef2ba7eb8409d962c2e57dba363c0ce6166993d 100644 (file)
@@ -1511,7 +1511,7 @@ Here's an example of a callback option that takes no arguments, and simply
 records that the option was seen::
 
    def record_foo_seen(option, opt_str, value, parser):
-       parser.saw_foo = True
+       parser.values.saw_foo = True
 
    parser.add_option("--foo", action="callback", callback=record_foo_seen)
 
@@ -1651,7 +1651,7 @@ arguments::
             value.append(arg)
 
         del parser.rargs[:len(value)]
-        setattr(parser.values, option.dest, value))
+        setattr(parser.values, option.dest, value)
 
    [...]
    parser.add_option("-c", "--callback", dest="vararg_attr",
index 63c4bc71a5c97d41ba66f72e6faae9ef96e1ab5a..9e556651b3080ac8cee21f454754a7ac39c291ce 100644 (file)
@@ -188,13 +188,13 @@ be found in any statistics text.
 
 .. function:: uniform(a, b)
 
-   Return a random floating point number *N* such that ``a <= N < b`` for
-   ``a <= b`` and ``b <= N < a`` for ``b < a``.
+   Return a random floating point number *N* such that ``a <= N <= b`` for
+   ``a <= b`` and ``b <= N <= a`` for ``b < a``.
 
 
 .. function:: triangular(low, high, mode)
 
-   Return a random floating point number *N* such that ``low <= N < high`` and
+   Return a random floating point number *N* such that ``low <= N <= high`` and
    with the specified *mode* between those bounds.  The *low* and *high* bounds
    default to zero and one.  The *mode* argument defaults to the midpoint
    between the bounds, giving a symmetric distribution.
@@ -204,8 +204,8 @@ be found in any statistics text.
 
 .. function:: betavariate(alpha, beta)
 
-   Beta distribution.  Conditions on the parameters are ``alpha > 0`` and ``beta >
-   0``. Returned values range between 0 and 1.
+   Beta distribution.  Conditions on the parameters are ``alpha > 0`` and
+   ``beta > 0``. Returned values range between 0 and 1.
 
 
 .. function:: expovariate(lambd)
@@ -219,14 +219,15 @@ be found in any statistics text.
 
 .. function:: gammavariate(alpha, beta)
 
-   Gamma distribution.  (*Not* the gamma function!)  Conditions on the parameters
-   are ``alpha > 0`` and ``beta > 0``.
+   Gamma distribution.  (*Not* the gamma function!)  Conditions on the
+   parameters are ``alpha > 0`` and ``beta > 0``.
 
 
 .. function:: gauss(mu, sigma)
 
-   Gaussian distribution.  *mu* is the mean, and *sigma* is the standard deviation.
-   This is slightly faster than the :func:`normalvariate` function defined below.
+   Gaussian distribution.  *mu* is the mean, and *sigma* is the standard
+   deviation.  This is slightly faster than the :func:`normalvariate` function
+   defined below.
 
 
 .. function:: lognormvariate(mu, sigma)
index 6ae9038daa8b31ac643cb31e52347ae240358b35..a4f181bf929bbb21d3db9fde55142096ae723532 100644 (file)
@@ -517,7 +517,7 @@ An example for the :class:`ThreadingMixIn` class::
        # Exit the server thread when the main thread terminates
        server_thread.setDaemon(True)
        server_thread.start()
-       print "Server loop running in thread:", t.getName()
+       print "Server loop running in thread:", server_thread.getName()
 
        client(ip, port, "Hello World 1")
        client(ip, port, "Hello World 2")
index 1ee7ea21841fcacbce138b7b45ac54fabb7cc551..0434ff229f276a80563e38a97a2684290e6a92d2 100644 (file)
@@ -375,7 +375,7 @@ All :class:`numbers.Real` types (:class:`int`, :class:`long`, and
 +--------------------+------------------------------------+--------+
 | Operation          | Result                             | Notes  |
 +====================+====================================+========+
-| ``trunc(x)``       | *x* truncated to Integral          |        |
+| ``math.trunc(x)``  | *x* truncated to Integral          |        |
 +--------------------+------------------------------------+--------+
 | ``round(x[, n])``  | *x* rounded to n digits,           |        |
 |                    | rounding half to even. If n is     |        |
@@ -601,9 +601,9 @@ Sequence Types --- :class:`str`, :class:`unicode`, :class:`list`, :class:`tuple`
 
 There are six sequence types: strings, Unicode strings, lists, tuples, buffers,
 and xrange objects.
-(For other containers see the built in :class:`dict`, :class:`list`,
-:class:`set`, and :class:`tuple` classes, and the :mod:`collections`
-module.)
+
+For other containers see the built in :class:`dict` and :class:`set` classes,
+and the :mod:`collections` module.
 
 
 .. index::
@@ -1648,7 +1648,7 @@ The constructors for both classes work the same:
    .. method:: union(other, ...)
                set | other | ...
 
-      Return a new set with elements from both sets.
+      Return a new set with elements from the set and all others.
 
       .. versionchanged:: 2.6
          Accepts multiple input iterables.
@@ -1656,7 +1656,7 @@ The constructors for both classes work the same:
    .. method:: intersection(other, ...)
                set & other & ...
 
-      Return a new set with elements common to both sets.
+      Return a new set with elements common to the set and all others.
 
       .. versionchanged:: 2.6
          Accepts multiple input iterables.
index 85860e5e404d98fddd3fa28bddb6c578793ef1c6..e6616dbcd279a5b8112c02c7051f84aaa32646cc 100644 (file)
@@ -210,7 +210,7 @@ changed through the :attr:`name` attribute.
 A thread can be flagged as a "daemon thread".  The significance of this flag is
 that the entire Python program exits when only daemon threads are left.  The
 initial value is inherited from the creating thread.  The flag can be set
-through the :attr:`daemon` attribute.
+through the :attr:`daemon` property.
 
 There is a "main thread" object; this corresponds to the initial thread of
 control in the Python program.  It is not a daemon thread.
@@ -332,10 +332,11 @@ impossible to detect the termination of alien threads.
 
 .. attribute:: Thread.daemon
 
-   The thread's daemon flag. This must be set before :meth:`start` is called,
-   otherwise :exc:`RuntimeError` is raised.
-
-   The initial value is inherited from the creating thread.
+   A boolean value indicating whether this thread is a daemon thread (True) or
+   not (False).  This must be set before :meth:`start` is called, otherwise
+   :exc:`RuntimeError` is raised.  Its initial value is inherited from the
+   creating thread; the main thread is not a daemon thread and therefore all
+   threads created in the main thread default to :attr:`daemon` = ``False``.
 
    The entire Python program exits when no alive non-daemon threads are left.
 
index 986e545737b930815a0ffadac424d90fab5e0910..e6f80616215c0c2ae723f2621448e9b96387e5eb 100644 (file)
@@ -602,14 +602,15 @@ HTTPRedirectHandler Objects
    precise meanings of the various redirection codes.
 
 
-.. method:: HTTPRedirectHandler.redirect_request(req, fp, code, msg, hdrs)
+.. method:: HTTPRedirectHandler.redirect_request(req, fp, code, msg, hdrs, newurl)
 
    Return a :class:`Request` or ``None`` in response to a redirect. This is called
    by the default implementations of the :meth:`http_error_30\*` methods when a
    redirection is received from the server.  If a redirection should take place,
    return a new :class:`Request` to allow :meth:`http_error_30\*` to perform the
-   redirect.  Otherwise, raise :exc:`HTTPError` if no other handler should try to
-   handle this URL, or return ``None`` if you can't but another handler might.
+   redirect to *newurl*.  Otherwise, raise :exc:`HTTPError` if no other handler
+   should try to handle this URL, or return ``None`` if you can't but another
+   handler might.
 
    .. note::
 
@@ -622,8 +623,8 @@ HTTPRedirectHandler Objects
 
 .. method:: HTTPRedirectHandler.http_error_301(req, fp, code, msg, hdrs)
 
-   Redirect to the ``Location:`` URL.  This method is called by the parent
-   :class:`OpenerDirector` when getting an HTTP 'moved permanently' response.
+   Redirect to the ``Location:`` or ``URI:`` URL.  This method is called by the
+   parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' response.
 
 
 .. method:: HTTPRedirectHandler.http_error_302(req, fp, code, msg, hdrs)
index 9aa1ea3b3f17b2e7e930d1c25efdeb87d1ac3a0a..38545c2083a0462d07756638f115a68544976efa 100644 (file)
@@ -529,5 +529,5 @@ This is an example of counting the maximum depth of an XML file::
 .. [#] The encoding string included in XML output should conform to the
    appropriate standards. For example, "UTF-8" is valid, but "UTF8" is
    not. See http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl
-   and http://www.iana.org/assignments/character-sets .
+   and http://www.iana.org/assignments/character-sets.
 
index 039a8a8d5ace83fcb05b0904d364c7189db62f5f..4035f8eeba639709bfd78e431bf46d5d1a2e1f90 100644 (file)
@@ -318,9 +318,8 @@ XMLRPC::
    import xmlrpclib
 
    def python_logo():
-        handle = open("python_logo.jpg")
-        return xmlrpclib.Binary(handle.read())
-        handle.close()
+        with open("python_logo.jpg") as handle:
+            return xmlrpclib.Binary(handle.read())
 
    server = SimpleXMLRPCServer(("localhost", 8000))
    print "Listening on port 8000..."
@@ -333,9 +332,8 @@ The client gets the image and saves it to a file::
    import xmlrpclib
 
    proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
-   handle = open("fetched_python_logo.jpg", "w")
-   handle.write(proxy.python_logo().data)
-   handle.close()
+   with open("fetched_python_logo.jpg", "w") as handle:
+       handle.write(proxy.python_logo().data)
 
 .. _fault-objects:
 
index fae73525fcbfd47ef4803a148c75d750eb156d2d..d70f6edd526e108e7a8233df6a381ab7864a01d8 100644 (file)
@@ -2078,13 +2078,13 @@ left undefined.
             object.__ixor__(self, other)
             object.__ior__(self, other)
 
-   These methods are called to implement the augmented arithmetic operations
+   These methods are called to implement the augmented arithmetic assignments
    (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, ``>>=``,
    ``&=``, ``^=``, ``|=``).  These methods should attempt to do the operation
    in-place (modifying *self*) and return the result (which could be, but does
    not have to be, *self*).  If a specific method is not defined, the augmented
-   operation falls back to the normal methods.  For instance, to evaluate the
-   expression ``x += y``, where *x* is an instance of a class that has an
+   assignment falls back to the normal methods.  For instance, to execute the
+   statement ``x += y``, where *x* is an instance of a class that has an
    :meth:`__iadd__` method, ``x.__iadd__(y)`` is called.  If *x* is an instance
    of a class that does not define a :meth:`__iadd__` method, ``x.__add__(y)``
    and ``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``.
@@ -2244,7 +2244,8 @@ will not be supported.
 
   In the current implementation, the built-in numeric types :class:`int`,
   :class:`long` and :class:`float` do not use coercion; the type :class:`complex`
-  however does use it.  The difference can become apparent when subclassing these
+  however does use coercion for binary operators and rich comparisons, despite
+  the above rules.  The difference can become apparent when subclassing these
   types.  Over time, the type :class:`complex` may be fixed to avoid coercion.
   All these types implement a :meth:`__coerce__` method, for use by the built-in
   :func:`coerce` function.
index 550644c9a6d113d79c8b4972c2431e8d59e530c8..3664ee95bdd7f986564b8acfbd7312f751298972 100644 (file)
@@ -816,14 +816,14 @@ Raising a negative number to a fractional power results in a :exc:`ValueError`.
 
 .. _unary:
 
-Unary arithmetic operations
-===========================
+Unary arithmetic and bitwise operations
+=======================================
 
 .. index::
    triple: unary; arithmetic; operation
    triple: unary; bitwise; operation
 
-All unary arithmetic (and bitwise) operations have the same priority:
+All unary arithmetic and bitwise operations have the same priority:
 
 .. productionlist::
    u_expr: `power` | "-" `u_expr` | "+" `u_expr` | "~" `u_expr`
@@ -1276,12 +1276,9 @@ groups from right to left).
 +-----------------------------------------------+-------------------------------------+
 | :keyword:`not` *x*                            | Boolean NOT                         |
 +-----------------------------------------------+-------------------------------------+
-| :keyword:`in`, :keyword:`not` :keyword:`in`   | Membership tests                    |
-+-----------------------------------------------+-------------------------------------+
-| :keyword:`is`, :keyword:`is not`              | Identity tests                      |
-+-----------------------------------------------+-------------------------------------+
-| ``<``, ``<=``, ``>``, ``>=``, ``<>``, ``!=``, | Comparisons                         |
-| ``==``                                        |                                     |
+| :keyword:`in`, :keyword:`not` :keyword:`in`,  | Comparisons, including membership   |
+| :keyword:`is`, :keyword:`is not`, ``<``,      | tests and identity tests,           |
+| ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` |                                     |
 +-----------------------------------------------+-------------------------------------+
 | ``|``                                         | Bitwise OR                          |
 +-----------------------------------------------+-------------------------------------+
@@ -1293,29 +1290,19 @@ groups from right to left).
 +-----------------------------------------------+-------------------------------------+
 | ``+``, ``-``                                  | Addition and subtraction            |
 +-----------------------------------------------+-------------------------------------+
-| ``*``, ``/``, ``%``                           | Multiplication, division, remainder |
-+-----------------------------------------------+-------------------------------------+
-| ``+x``, ``-x``                                | Positive, negative                  |
-+-----------------------------------------------+-------------------------------------+
-| ``~x``                                        | Bitwise not                         |
-+-----------------------------------------------+-------------------------------------+
-| ``**``                                        | Exponentiation                      |
+| ``*``, ``/``, ``//``, ``%``                   | Multiplication, division, remainder |
 +-----------------------------------------------+-------------------------------------+
-| ``x[index]``                                  | Subscription                        |
+| ``+x``, ``-x``, ``~x``                        | Positive, negative, bitwise NOT     |
 +-----------------------------------------------+-------------------------------------+
-| ``x[index:index]``                            | Slicing                             |
+| ``**``                                        | Exponentiation [#]_                 |
 +-----------------------------------------------+-------------------------------------+
-| ``x(arguments...)``                           | Call                                |
+| ``x[index]``, ``x[index:index]``,             | Subscription, slicing,              |
+| ``x(arguments...)``, ``x.attribute``          | call, attribute reference           |
 +-----------------------------------------------+-------------------------------------+
-| ``x.attribute``                               | Attribute reference                 |
-+-----------------------------------------------+-------------------------------------+
-| ``(expressions...)``                          | Binding or tuple display            |
-+-----------------------------------------------+-------------------------------------+
-| ``[expressions...]``                          | List display                        |
-+-----------------------------------------------+-------------------------------------+
-| ``{key:datum...}``                            | Dictionary display                  |
-+-----------------------------------------------+-------------------------------------+
-| ```expressions...```                          | String conversion                   |
+| ``(expressions...)``,                         | Binding or tuple display,           |
+| ``[expressions...]``,                         | list display,                       |
+| ``{key:datum...}``,                           | dictionary display,                 |
+| ```expressions...```                          | string conversion                   |
 +-----------------------------------------------+-------------------------------------+
 
 .. rubric:: Footnotes
@@ -1358,3 +1345,6 @@ groups from right to left).
    descriptors, you may notice seemingly unusual behaviour in certain uses of
    the :keyword:`is` operator, like those involving comparisons between instance
    methods, or constants.  Check their documentation for more info.
+
+.. [#] The power operator ``**`` binds less tightly than an arithmetic or
+   bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.
index 8b2cceb3afc9fbd3c12ca611eb6713b88c629974..69bd41dbe6c7fcae88d2fead598a2afbf9531867 100644 (file)
@@ -65,8 +65,7 @@ IronPython
    An alternate Python for .NET.  Unlike Python.NET, this is a complete Python
    implementation that generates IL, and compiles Python code directly to .NET
    assemblies.  It was created by Jim Hugunin, the original creator of Jython.  For
-   more information, see `the IronPython website
-   <http://workspaces.gotdotnet.com/ironpython>`_.
+   more information, see `the IronPython website <http://www.ironpython.com/>`_.
 
 PyPy
    An implementation of Python written in Python; even the bytecode interpreter is
index d43ee8b864b7c6873686d502b7f5a18b175c6edc..87ce4032de827e6bbb99c7ff87d08f403e56a6eb 100644 (file)
@@ -118,8 +118,8 @@ Assignment of an object to a target list is recursively defined as follows.
 
 * If the target list is a single target: The object is assigned to that target.
 
-* If the target list is a comma-separated list of targets: The object must be a
-  sequence with the same number of items as there are targets in the target list,
+* If the target list is a comma-separated list of targets: The object must be an
+  iterable with the same number of items as there are targets in the target list,
   and the items are assigned, from left to right, to the corresponding targets.
   (This rule is relaxed as of Python 1.5; in earlier versions, the object had to
   be a tuple.  Since strings are sequences, an assignment like ``a, b = "xy"`` is
@@ -143,9 +143,9 @@ Assignment of an object to a single target is recursively defined as follows.
   be deallocated and its destructor (if it has one) to be called.
 
 * If the target is a target list enclosed in parentheses or in square brackets:
-  The object must be a sequence with the same number of items as there are targets
-  in the target list, and its items are assigned, from left to right, to the
-  corresponding targets.
+  The object must be an iterable with the same number of items as there are
+  targets in the target list, and its items are assigned, from left to right,
+  to the corresponding targets.
 
   .. index:: pair: attribute; assignment
 
@@ -228,7 +228,8 @@ Augmented assignment is the combination, in a single statement, of a binary
 operation and an assignment statement:
 
 .. productionlist::
-   augmented_assignment_stmt: `target` `augop` (`expression_list` | `yield_expression`)
+   augmented_assignment_stmt: `augtarget` `augop` (`expression_list` | `yield_expression`)
+   augtarget: `identifier` | `attributeref` | `subscription` | `slicing`
    augop: "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="
         : | ">>=" | "<<=" | "&=" | "^=" | "|="
 
index 3ea04bdecc5f107d91f10242a8b03fab24f31d25..0c19003b0fb5ef3c6df5fc5c740e4331be98716d 100755 (executable)
@@ -6,6 +6,9 @@
 #
 # 01/2009, Georg Brandl
 
+# TODO: - wrong versions in versionadded/changed
+#       - wrong markup after versionchanged directive
+
 from __future__ import with_statement
 
 import os
index 48ce6dacb64053e111afdba29dc9cc2240d09559..688de95b8ea09bb9d94cf36b20d4190e2856c1f7 100644 (file)
@@ -13,6 +13,14 @@ ISSUE_URI = 'http://bugs.python.org/issue%s'
 
 from docutils import nodes, utils
 
+# monkey-patch reST parser to disable alphabetic and roman enumerated lists
+from docutils.parsers.rst.states import Body
+Body.enum.converters['loweralpha'] = \
+    Body.enum.converters['upperalpha'] = \
+    Body.enum.converters['lowerroman'] = \
+    Body.enum.converters['upperroman'] = lambda x: None
+
+
 def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
     issue = utils.unescape(text)
     text = 'issue ' + issue
index e1e2887614a4408ec516dfde2483fa604bd1f4a9..ca87dbb1ee8635c694ababc134b634a503fd0f87 100644 (file)
@@ -1761,8 +1761,8 @@ ElementTree 1.2.6.    The :mod:`cElementTree` accelerator module is also
 included.
 
 The rest of this section will provide a brief overview of using ElementTree.
-Full documentation for ElementTree is available at http://effbot.org/zone
-/element-index.htm.
+Full documentation for ElementTree is available at
+http://effbot.org/zone/element-index.htm.
 
 ElementTree represents an XML document as a tree of element nodes. The text
 content of the document is stored as the :attr:`.text` and :attr:`.tail`
index 00a5aae5936d31be86f3fbaa90e3459e42fc406c..15366909d2077bb0343834a617f5d4c574ae47a9 100644 (file)
@@ -271,7 +271,6 @@ class ASTHelpers_Test(unittest.TestCase):
         self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None))
         self.assertRaises(ValueError, ast.literal_eval, 'foo()')
 
-
 def test_main():
     test_support.run_unittest(AST_Tests, ASTHelpers_Test)