]> granicus.if.org Git - python/commitdiff
Merged revisions 74008,74021-74022,74074-74075,74077,74148,74179,74188,74192-74194...
authorGeorg Brandl <georg@python.org>
Tue, 27 Oct 2009 14:34:21 +0000 (14:34 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 27 Oct 2009 14:34:21 +0000 (14:34 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74008 | benjamin.peterson | 2009-07-15 02:46:42 +0200 (Mi, 15 Jul 2009) | 1 line

  update year
........
  r74021 | georg.brandl | 2009-07-16 09:33:04 +0200 (Do, 16 Jul 2009) | 1 line

  #6486: start with built in functions rather than "built in objects".
........
  r74022 | georg.brandl | 2009-07-16 09:38:35 +0200 (Do, 16 Jul 2009) | 1 line

  #6481: fix typo in os.system() replacement.
........
  r74074 | georg.brandl | 2009-07-18 11:03:10 +0200 (Sa, 18 Jul 2009) | 1 line

  #6513: fix example code: warning categories are classes, not instances.
........
  r74075 | georg.brandl | 2009-07-18 11:06:31 +0200 (Sa, 18 Jul 2009) | 1 line

  #6505: fix typos.
........
  r74077 | georg.brandl | 2009-07-18 11:43:40 +0200 (Sa, 18 Jul 2009) | 1 line

  #6489: fix an ambiguity in getiterator() documentation.
........
  r74148 | ezio.melotti | 2009-07-21 22:18:27 +0200 (Di, 21 Jul 2009) | 1 line

  #6536 fixed typo
........
  r74179 | ezio.melotti | 2009-07-22 23:08:49 +0200 (Mi, 22 Jul 2009) | 1 line

  #6423 has_key -> in
........
  r74188 | benjamin.peterson | 2009-07-23 16:25:31 +0200 (Do, 23 Jul 2009) | 1 line

  use bools
........
  r74192 | georg.brandl | 2009-07-24 18:28:38 +0200 (Fr, 24 Jul 2009) | 1 line

  Fix arg types of et#.
........
  r74193 | georg.brandl | 2009-07-24 18:46:38 +0200 (Fr, 24 Jul 2009) | 1 line

  Dont put "void" in signature for nullary functions.
........
  r74194 | georg.brandl | 2009-07-24 22:09:46 +0200 (Fr, 24 Jul 2009) | 1 line

  #6564: fix section about the two raise syntaxes.
........
  r74200 | georg.brandl | 2009-07-25 15:02:15 +0200 (Sa, 25 Jul 2009) | 1 line

  #6571: add index entries for more operators.
........
  r74205 | georg.brandl | 2009-07-26 15:36:39 +0200 (So, 26 Jul 2009) | 1 line

  #6576: fix cross-refs in re docs.
........

20 files changed:
Doc/c-api/arg.rst
Doc/c-api/float.rst
Doc/c-api/int.rst
Doc/c-api/method.rst
Doc/c-api/sys.rst
Doc/c-api/tuple.rst
Doc/c-api/type.rst
Doc/c-api/unicode.rst
Doc/copyright.rst
Doc/howto/urllib2.rst
Doc/library/cgi.rst
Doc/library/intro.rst
Doc/library/re.rst
Doc/library/stdtypes.rst
Doc/library/subprocess.rst
Doc/library/warnings.rst
Doc/library/webbrowser.rst
Doc/library/xml.etree.elementtree.rst
Doc/tutorial/errors.rst
Doc/tutorial/inputoutput.rst

index f34e4b449e32c0c518a041b8dcfeface00094b91..47748611d4029e14e9597e8e95d84c9541f837d0 100644 (file)
@@ -136,7 +136,7 @@ of the C variable(s) whose address should be passed.
    In both cases, *\*buffer_length* is set to the length of the encoded data
    without the trailing NUL byte.
 
-``et#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
+``et#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
    Same as ``es#`` except that string objects are passed through without
    recoding them. Instead, the implementation assumes that the string object
    uses the encoding passed in as parameter.
index f70529752fdbadb378486e9f306364ff98245c44..c4099a305753b11a0d6a552216a8ec717e35bf29 100644 (file)
@@ -72,21 +72,21 @@ Floating Point Objects
    .. versionadded:: 2.6
 
 
-.. cfunction:: double PyFloat_GetMax(void)
+.. cfunction:: double PyFloat_GetMax()
 
    Return the maximum representable finite float *DBL_MAX* as C :ctype:`double`.
 
    .. versionadded:: 2.6
 
 
-.. cfunction:: double PyFloat_GetMin(void)
+.. cfunction:: double PyFloat_GetMin()
 
    Return the minimum normalized positive float *DBL_MIN* as C :ctype:`double`.
 
    .. versionadded:: 2.6
 
 
-.. cfunction:: int PyFloat_ClearFreeList(void)
+.. cfunction:: int PyFloat_ClearFreeList()
 
    Clear the float free list. Return the number of items that could not
    be freed.
index 9ff0347d05c71df891e23c463b932ef801d6a937..c561bc2eeace823bf4f064dd2a9fefa4a63fb16e 100644 (file)
@@ -131,7 +131,7 @@ Plain Integer Objects
    (:const:`LONG_MAX`, as defined in the system header files).
 
 
-.. cfunction:: int PyInt_ClearFreeList(void)
+.. cfunction:: int PyInt_ClearFreeList()
 
    Clear the integer free list. Return the number of items that could not
    be freed.
index c104f8995ba35df5e0b10def5428d76865c341cf..add1f0fe356b55c3cf24fa799ae6877be2e9c30d 100644 (file)
@@ -65,7 +65,7 @@ There are some useful functions that are useful for working with method objects.
    Macro version of :cfunc:`PyMethod_Self` which avoids error checking.
 
 
-.. cfunction:: int PyMethod_ClearFreeList(void)
+.. cfunction:: int PyMethod_ClearFreeList()
 
    Clear the free list. Return the total number of freed items.
 
index 7696811a78dc6e80500ce026ea606e0822c57a35..f46fb9a0b73b78610028f5ca96c13ae398c7df5e 100644 (file)
@@ -80,7 +80,7 @@ accessible to C code.  They all work with the current interpreter thread's
    case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``
    on error.
 
-.. cfunction:: void PySys_ResetWarnOptions(void)
+.. cfunction:: void PySys_ResetWarnOptions()
 
    Reset :data:`sys.warnoptions` to an empty list.
 
index 53db2a183989618a83a78f01b157763a816488ac..eb479d5abc7c53694dd099ab8afabd49e3096219 100644 (file)
@@ -157,7 +157,7 @@ Tuple Objects
       require changes in your code for properly supporting 64-bit systems.
 
 
-.. cfunction:: int PyTuple_ClearFreeList(void)
+.. cfunction:: int PyTuple_ClearFreeList()
 
    Clear the free list. Return the total number of freed items.
 
index 77a3aec31c89aa96614ea2ff470f6b69af11f0a2..7d1c773ca191e779e103cc9f71b586edd0117900 100644 (file)
@@ -35,7 +35,7 @@ Type Objects
    .. versionadded:: 2.2
 
 
-.. cfunction:: unsigned int PyType_ClearCache(void)
+.. cfunction:: unsigned int PyType_ClearCache()
 
    Clear the internal lookup cache. Return the current version tag.
 
index 8469ff97fd307da3b02aec08a20775f1dd049209..b60373464862e7a906e8dc3a04083ef8275130fa 100644 (file)
@@ -98,12 +98,13 @@ access internal read-only data of Unicode objects:
    :ctype:`PyUnicodeObject` (not checked).
 
 
-.. cfunction:: int PyUnicode_ClearFreeList(void)
+.. cfunction:: int PyUnicode_ClearFreeList()
 
    Clear the free list. Return the total number of freed items.
 
    .. versionadded:: 2.6
 
+
 Unicode provides many different character properties. The most often needed ones
 are available through these macros which are mapped to C functions depending on
 the Python configuration.
index 376b1c4d63d2ba32e99a24877e5a4da2dd422625..ec78a38c38c2dbc38d22ff1332a82420f18e098a 100644 (file)
@@ -4,7 +4,7 @@ Copyright
 
 Python and this documentation is:
 
-Copyright © 2001-2008 Python Software Foundation. All rights reserved.
+Copyright © 2001-2009 Python Software Foundation. All rights reserved.
 
 Copyright © 2000 BeOpen.com. All rights reserved.
 
index 629c38d8f6c326f3cfde453fdd1b3cbc9f9d2ae7..409bc8ea29b3064a55c4aedba24ec44fec4ac928 100644 (file)
@@ -488,7 +488,7 @@ than the URL you pass to .add_password() will also match. ::
 
 .. note::
 
-    In the above example we only supplied our ``HHTPBasicAuthHandler`` to
+    In the above example we only supplied our ``HTTPBasicAuthHandler`` to
     ``build_opener``. By default openers have the handlers for normal situations
     -- ``ProxyHandler``, ``UnknownHandler``, ``HTTPHandler``,
     ``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``,
index 1e14e4b14dc71194039b9fa3f35c32e18caeea79..58222eafdbae750e12367dcc3453efbb6d6c7987 100644 (file)
@@ -91,12 +91,13 @@ form contents from standard input or the environment (depending on the value of
 various environment variables set according to the CGI standard).  Since it may
 consume standard input, it should be instantiated only once.
 
-The :class:`FieldStorage` instance can be indexed like a Python dictionary, and
-also supports the standard dictionary methods :meth:`has_key` and :meth:`keys`.
-The built-in :func:`len` is also supported.  Form fields containing empty
-strings are ignored and do not appear in the dictionary; to keep such values,
-provide a true value for the optional *keep_blank_values* keyword parameter when
-creating the :class:`FieldStorage` instance.
+The :class:`FieldStorage` instance can be indexed like a Python dictionary.
+It allows membership testing with the :keyword:`in` operator, and also supports
+the standard dictionary method :meth:`keys` and the built-in function
+:func:`len`.  Form fields containing empty strings are ignored and do not appear
+in the dictionary; to keep such values, provide a true value for the optional
+*keep_blank_values* keyword parameter when creating the :class:`FieldStorage`
+instance.
 
 For instance, the following code (which assumes that the
 :mailheader:`Content-Type` header and blank line have already been printed)
@@ -104,7 +105,7 @@ checks that the fields ``name`` and ``addr`` are both set to a non-empty
 string::
 
    form = cgi.FieldStorage()
-   if not (form.has_key("name") and form.has_key("addr")):
+   if "name" not in form or "addr" not in form:
        print "<H1>Error</H1>"
        print "Please fill in the name and addr fields."
        return
index 33bdefd72edcce8276f8a5111516280aa3fbe81b..5e5fc802fbcf36ba5dcc725fda361ce0ef2e0ecf 100644 (file)
@@ -44,8 +44,9 @@ browse the table of contents (in front of the manual), or look for a specific
 function, module or term in the index (in the back).  And finally, if you enjoy
 learning about random subjects, you choose a random page number (see module
 :mod:`random`) and read a section or two.  Regardless of the order in which you
-read the sections of this manual, it helps to start with chapter :ref:`builtin`,
-as the remainder of the manual assumes familiarity with this material.
+read the sections of this manual, it helps to start with chapter
+:ref:`built-in-funcs`, as the remainder of the manual assumes familiarity with
+this material.
 
 Let the show begin!
 
index d2c95580532c60239b27f16c0e29862527d01bd9..374e750423e7d97456d3a25fe365221f7a8bc8b6 100644 (file)
@@ -216,7 +216,7 @@ The special characters are:
    flags are described in :ref:`contents-of-module-re`.) This
    is useful if you wish to include the flags as part of the regular
    expression, instead of passing a *flag* argument to the
-   :func:`compile` function.
+   :func:`re.compile` function.
 
    Note that the ``(?x)`` flag changes how the expression is parsed. It should be
    used first in the expression string, or after one or more whitespace characters.
@@ -443,9 +443,9 @@ form.
 
       result = re.match(pattern, string)
 
-   but using :func:`compile` and saving the resulting regular expression object
-   for reuse is more efficient when the expression will be used several times
-   in a single program.
+   but using :func:`re.compile` and saving the resulting regular expression
+   object for reuse is more efficient when the expression will be used several
+   times in a single program.
 
    .. note::
 
@@ -532,7 +532,7 @@ form.
 
    .. note::
 
-      If you want to locate a match anywhere in *string*, use :meth:`search`
+      If you want to locate a match anywhere in *string*, use :func:`search`
       instead.
 
 
@@ -686,8 +686,8 @@ attributes:
 
    .. note::
 
-      If you want to locate a match anywhere in *string*, use :meth:`search`
-      instead.
+      If you want to locate a match anywhere in *string*, use
+      :meth:`~RegexObject.search` instead.
 
    The optional second parameter *pos* gives an index in the string where the
    search is to start; it defaults to ``0``.  This is not completely equivalent to
@@ -716,7 +716,7 @@ attributes:
    is different from finding a zero-length match at some point in the string.
 
    The optional *pos* and *endpos* parameters have the same meaning as for the
-   :meth:`match` method.
+   :meth:`~RegexObject.match` method.
 
 
 .. method:: RegexObject.split(string[, maxsplit=0])
@@ -780,10 +780,10 @@ support the following methods and attributes:
 .. method:: MatchObject.expand(template)
 
    Return the string obtained by doing backslash substitution on the template
-   string *template*, as done by the :meth:`sub` method. Escapes such as ``\n`` are
-   converted to the appropriate characters, and numeric backreferences (``\1``,
-   ``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the
-   contents of the corresponding group.
+   string *template*, as done by the :meth:`~RegexObject.sub` method.  Escapes
+   such as ``\n`` are converted to the appropriate characters, and numeric
+   backreferences (``\1``, ``\2``) and named backreferences (``\g<1>``,
+   ``\g<name>``) are replaced by the contents of the corresponding group.
 
 
 .. method:: MatchObject.group([group1, ...])
@@ -907,16 +907,16 @@ support the following methods and attributes:
 
 .. attribute:: MatchObject.pos
 
-   The value of *pos* which was passed to the :func:`search` or :func:`match`
-   method of the :class:`RegexObject`.  This is the index into the string at which
-   the RE engine started looking for a match.
+   The value of *pos* which was passed to the :meth:`~RegexObject.search` or
+   :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
+   index into the string at which the RE engine started looking for a match.
 
 
 .. attribute:: MatchObject.endpos
 
-   The value of *endpos* which was passed to the :func:`search` or :func:`match`
-   method of the :class:`RegexObject`.  This is the index into the string beyond
-   which the RE engine will not go.
+   The value of *endpos* which was passed to the :meth:`~RegexObject.search` or
+   :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
+   index into the string beyond which the RE engine will not go.
 
 
 .. attribute:: MatchObject.lastindex
@@ -936,13 +936,15 @@ support the following methods and attributes:
 
 .. attribute:: MatchObject.re
 
-   The regular expression object whose :meth:`match` or :meth:`search` method
-   produced this :class:`MatchObject` instance.
+   The regular expression object whose :meth:`~RegexObject.match` or
+   :meth:`~RegexObject.search` method produced this :class:`MatchObject`
+   instance.
 
 
 .. attribute:: MatchObject.string
 
-   The string passed to :func:`match` or :func:`search`.
+   The string passed to :meth:`~RegexObject.match` or
+   :meth:`~RegexObject.search`.
 
 
 Examples
@@ -987,8 +989,9 @@ To match this with a regular expression, one could use backreferences as such:
    >>> displaymatch(pair.match("354aa"))     # Pair of aces.
    "<Match: '354aa', groups=('a',)>"
 
-To find out what card the pair consists of, one could use the :func:`group`
-method of :class:`MatchObject` in the following manner:
+To find out what card the pair consists of, one could use the
+:meth:`~MatchObject.group` method of :class:`MatchObject` in the following
+manner:
 
 .. doctest::
 
index 57f96a9b3d4068bb6ba7655ab475db8a7c3f8df3..2a0a2820b2b6d4e2c3bcefd46421a898ec0d56cb 100644 (file)
@@ -129,7 +129,17 @@ Notes:
 Comparisons
 ===========
 
-.. index:: pair: chaining; comparisons
+.. index::
+   pair: chaining; comparisons
+   pair: operator; comparison
+   operator: ==
+   operator: <
+   operator: <=
+   operator: >
+   operator: >=
+   operator: !=
+   operator: is
+   operator: is not
 
 Comparison operations are supported by all objects.  They all have the same
 priority (which is higher than that of the Boolean operations). Comparisons can
@@ -159,17 +169,6 @@ This table summarizes the comparison operations:
 | ``is not`` | negated object identity |       |
 +------------+-------------------------+-------+
 
-.. index::
-   pair: operator; comparison
-   operator: ==
-   operator: <
-   operator: <=
-   operator: >
-   operator: >=
-   operator: !=
-   operator: is
-   operator: is not
-
 Notes:
 
 (1)
@@ -262,6 +261,13 @@ part.
    builtin: long
    builtin: float
    builtin: complex
+   operator: +
+   operator: -
+   operator: *
+   operator: /
+   operator: //
+   operator: %
+   operator: **
 
 Python fully supports mixed arithmetic: when a binary arithmetic operator has
 operands of different numeric types, the operand with the "narrower" type is
@@ -394,7 +400,15 @@ All :class:`numbers.Real` types (:class:`int`, :class:`long`, and
 Bit-string Operations on Integer Types
 --------------------------------------
 
-.. _bit-string-operations:
+.. index::
+   triple: operations on; integer; types
+   pair: bit-string; operations
+   pair: shifting; operations
+   pair: masking; operations
+   operator: ^
+   operator: &
+   operator: <<
+   operator: >>
 
 Plain and long integer types support additional operations that make sense only
 for bit-strings.  Negative numbers are treated as their 2's complement value
@@ -426,12 +440,6 @@ This table lists the bit-string operations sorted in ascending priority:
 | ``~x``     | the bits of *x* inverted       |          |
 +------------+--------------------------------+----------+
 
-.. index::
-   triple: operations on; integer; types
-   pair: bit-string; operations
-   pair: shifting; operations
-   pair: masking; operations
-
 Notes:
 
 (1)
index bc37d330e5230c8bfd0bf0710c626e946c4d0401..a7ef3ffd124ac3e0ecd027c10729686764b99b89 100644 (file)
@@ -369,7 +369,7 @@ Replacing :func:`os.system`
    sts = os.system("mycmd" + " myarg")
    ==>
    p = Popen("mycmd" + " myarg", shell=True)
-   sts = os.waitpid(p.pid, 0)
+   sts = os.waitpid(p.pid, 0)[1]
 
 Notes:
 
index 77fe5eed2ed5fce9b70653ac9581ad38f9e041a1..3868b74809e5ab3c2b3242b819b6b7103f0079ea 100644 (file)
@@ -204,7 +204,7 @@ check::
         fxn()
         # Verify some things
         assert len(w) == 1
-        assert isinstance(w[-1].category, DeprecationWarning)
+        assert issubclass(w[-1].category, DeprecationWarning)
         assert "deprecated" in str(w[-1].message)
 
 One can also cause all warnings to be exceptions by using ``error`` instead of
index b50bdbe8161e8b97862a53b8f641203bdcdf94cd..87b97b1ee19ee75c8119a25067cff69b2bbdd45e 100644 (file)
@@ -46,14 +46,14 @@ The following exception is defined:
 The following functions are defined:
 
 
-.. function:: open(url[, new=0[, autoraise=1]])
+.. function:: open(url[, new=0[, autoraise=True]])
 
-   Display *url* using the default browser. If *new* is 0, the *url* is opened in
-   the same browser window if possible.  If *new* is 1, a new browser window is
-   opened if possible.  If *new* is 2, a new browser page ("tab") is opened if
-   possible.  If *autoraise* is true, the window is raised if possible (note that
-   under many window managers this will occur regardless of the setting of this
-   variable).
+   Display *url* using the default browser. If *new* is 0, the *url* is opened
+   in the same browser window if possible.  If *new* is 1, a new browser window
+   is opened if possible.  If *new* is 2, a new browser page ("tab") is opened
+   if possible.  If *autoraise* is ``True``, the window is raised if possible
+   (note that under many window managers this will occur regardless of the
+   setting of this variable).
 
    Note that on some platforms, trying to open a filename using this function,
    may work and start the operating system's associated program.  However, this
@@ -180,7 +180,7 @@ Browser controllers provide these methods which parallel three of the
 module-level convenience functions:
 
 
-.. method:: controller.open(url[, new[, autoraise=1]])
+.. method:: controller.open(url[, new[, autoraise=True]])
 
    Display *url* using the browser handled by this controller. If *new* is 1, a new
    browser window is opened if possible. If *new* is 2, a new browser page ("tab")
index 38545c2083a0462d07756638f115a68544976efa..e074d554a0f43d344e0cc6ef3edfb5d71fc787e3 100644 (file)
@@ -262,9 +262,9 @@ The following methods work on the element's children (subelements).
 .. method:: Element.getiterator([tag=None])
 
    Creates a tree iterator with the current element as the root.   The iterator
-   iterates over this element and all elements below it  that match the given tag.
-   If tag is ``None`` or ``'*'`` then all elements are iterated over. Returns an
-   iterable that provides element objects in document (depth first) order.
+   iterates over this element and all elements below it, in document (depth first)
+   order.  If *tag* is not ``None`` or ``'*'``, only elements whose tag equals
+   *tag* are returned from the iterator.
 
 
 .. method:: Element.insert(index, element)
index 28d6565f2a25f204eb2605830c59fa5554fbdc9f..d547ef7fccc85e5d33143d830bf11e841d3b777c 100644 (file)
@@ -221,9 +221,11 @@ exception to occur. For example::
      File "<stdin>", line 1, in ?
    NameError: HiThere
 
-The sole argument to :keyword:`raise` indicates the exception to be raised.
-This must be either an exception instance or an exception class (a class that
-derives from :class:`Exception`).
+The argument to :keyword:`raise` is an exception class or instance to be
+raised.  There is a deprecated alternate syntax that separates class and
+constructor arguments; the above could be written as ``raise NameError,
+'HiThere'``.  Since it once was the only one available, the latter form is
+prevalent in older code.
 
 If you need to determine whether an exception was raised but don't intend to
 handle it, a simpler form of the :keyword:`raise` statement allows you to
index b1bc522b187794b829ddc5f549f75bd5ab2309b9..bfbc9a62fdc51e75a2d812bd5e1bdd42272138c2 100644 (file)
@@ -148,9 +148,9 @@ Positional and keyword arguments can be arbitrarily combined::
    ...                                                    other='Georg')
    The story of Bill, Manfred, and Georg.
 
-An optional ``':'`` and format specifier can follow the field name. This also
+An optional ``':'`` and format specifier can follow the field name. This allows
 greater control over how the value is formatted.  The following example
-truncates the Pi to three places after the decimal.
+truncates Pi to three places after the decimal.
 
    >>> import math
    >>> print 'The value of PI is approximately {0:.3f}.'.format(math.pi)
@@ -204,8 +204,8 @@ operation. For example::
    The value of PI is approximately 3.142.
 
 Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``
-operator. However, because this old style of formatting will eventually removed
-from the language :meth:`str.format` should generally be used.
+operator. However, because this old style of formatting will eventually be
+removed from the language, :meth:`str.format` should generally be used.
 
 More information can be found in the :ref:`string-formatting` section.