Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r61209 | georg.brandl | 2008-03-03 21:37:55 +0100 (Mon, 03 Mar 2008) | 2 lines

  There are now sixteen isfoo functions.
........
  r61210 | georg.brandl | 2008-03-03 21:39:00 +0100 (Mon, 03 Mar 2008) | 2 lines

  15 -> 16, the 2nd
........
  r61211 | georg.brandl | 2008-03-03 22:22:47 +0100 (Mon, 03 Mar 2008) | 2 lines

  Actually import itertools.
........
  r61212 | georg.brandl | 2008-03-03 22:31:50 +0100 (Mon, 03 Mar 2008) | 2 lines

  Expand a bit on genexp scopes.
........
  r61213 | raymond.hettinger | 2008-03-03 23:04:55 +0100 (Mon, 03 Mar 2008) | 1 line

  Remove dependency on itertools -- a simple genexp suffices.
........
  r61214 | raymond.hettinger | 2008-03-03 23:19:58 +0100 (Mon, 03 Mar 2008) | 1 line

  Issue 2226: Callable checked for the wrong abstract method.
........
  r61217 | andrew.kuchling | 2008-03-04 01:40:32 +0100 (Tue, 04 Mar 2008) | 1 line

  Typo fix
........
  r61218 | andrew.kuchling | 2008-03-04 02:30:10 +0100 (Tue, 04 Mar 2008) | 1 line

  Grammar fix; markup fix
........
  r61219 | andrew.kuchling | 2008-03-04 02:47:38 +0100 (Tue, 04 Mar 2008) | 1 line

  Fix sentence fragment
........
  r61220 | andrew.kuchling | 2008-03-04 02:48:26 +0100 (Tue, 04 Mar 2008) | 1 line

  Typo fix
........
  r61221 | andrew.kuchling | 2008-03-04 02:49:37 +0100 (Tue, 04 Mar 2008) | 1 line

  Add versionadded tags
........
  r61222 | andrew.kuchling | 2008-03-04 02:50:32 +0100 (Tue, 04 Mar 2008) | 1 line

  Thesis night results: add various items
........
  r61224 | raymond.hettinger | 2008-03-04 05:17:08 +0100 (Tue, 04 Mar 2008) | 1 line

  Beef-up docs and tests for itertools.  Fix-up end-case for product().
........
  r61225 | georg.brandl | 2008-03-04 08:25:54 +0100 (Tue, 04 Mar 2008) | 2 lines

  Fix some patch attributions.
........
  r61226 | georg.brandl | 2008-03-04 08:33:30 +0100 (Tue, 04 Mar 2008) | 2 lines

  #2230: document that PyArg_* leaves addresses alone on error.
........
  r61233 | neal.norwitz | 2008-03-04 17:22:46 +0100 (Tue, 04 Mar 2008) | 3 lines

  Close the file before trying to remove the directory so it works on Windows.
  As reported by Trent Nelson on python-dev.
........
  r61234 | thomas.heller | 2008-03-04 21:09:11 +0100 (Tue, 04 Mar 2008) | 9 lines

  Merged changes from libffi3-branch.

  The bundled libffi copy is now in sync with the recently released
  libffi3.0.4 version, apart from some small changes to
  Modules/_ctypes/libffi/configure.ac.

  I gave up on using libffi3 files on os x.
  Instead, static configuration with files from pyobjc is used.
........
  r61235 | thomas.heller | 2008-03-04 21:21:42 +0100 (Tue, 04 Mar 2008) | 1 line

  Try to fix the build for PY_LINUX.
........
  r61236 | fred.drake | 2008-03-04 22:14:04 +0100 (Tue, 04 Mar 2008) | 2 lines

  fix typo
........
  r61237 | raymond.hettinger | 2008-03-04 23:29:44 +0100 (Tue, 04 Mar 2008) | 1 line

  Fix refleak in chain().
........
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index c2bc15c..d622e1d 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -26,7 +26,7 @@
 -----------------
 
 The :func:`getmembers` function retrieves the members of an object such as a
-class or module. The fifteen functions whose names begin with "is" are mainly
+class or module. The sixteen functions whose names begin with "is" are mainly
 provided as convenient choices for the second argument to :func:`getmembers`.
 They also help you determine when you can expect to find the following special
 attributes:
@@ -267,8 +267,6 @@
 
    Return true if the object is an abstract base class.
 
-   .. versionadded:: 2.6
-
 
 .. function:: ismethoddescriptor(object)
 
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 9da51aa..0d74c59 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -87,6 +87,7 @@
 
    .. versionadded:: 2.6
 
+
 .. function:: combinations(iterable, r)
 
    Return successive *r* length combinations of elements in the *iterable*.
@@ -121,6 +122,17 @@
                     indices[j] = indices[j-1] + 1
                 yield tuple(pool[i] for i in indices)
 
+   The code for :func:`combinations` can be also expressed as a subsequence
+   of :func:`permutations` after filtering entries where the elements are not
+   in sorted order (according to their position in the input pool)::
+
+        def combinations(iterable, r):
+            pool = tuple(iterable)
+            n = len(pool)
+            for indices in permutations(range(n), r):
+                if sorted(indices) == list(indices):
+                    yield tuple(pool[i] for i in indices)
+
    .. versionadded:: 2.6
 
 .. function:: count([n])
@@ -378,6 +390,18 @@
                 else:
                     return
 
+   The code for :func:`permutations` can be also expressed as a subsequence of 
+   :func:`product`, filtered to exclude entries with repeated elements (those
+   from the same position in the input pool)::
+
+        def permutations(iterable, r=None):
+            pool = tuple(iterable)
+            n = len(pool)
+            r = n if r is None else r
+            for indices in product(range(n), repeat=r):
+                if len(set(indices)) == r:
+                    yield tuple(pool[i] for i in indices)
+
    .. versionadded:: 2.6
 
 .. function:: product(*iterables[, repeat])
@@ -388,26 +412,25 @@
    ``product(A, B)`` returns the same as ``((x,y) for x in A for y in B)``.
 
    The leftmost iterators are in the outermost for-loop, so the output tuples
-   cycle in a manner similar to an odometer (with the rightmost element
-   changing on every iteration).  This results in a lexicographic ordering
-   so that if the inputs iterables are sorted, the product tuples are emitted
+   cycle like an odometer (with the rightmost element changing on every 
+   iteration).  This results in a lexicographic ordering so that if the 
+   inputs iterables are sorted, the product tuples are emitted
    in sorted order.
 
    To compute the product of an iterable with itself, specify the number of
    repetitions with the optional *repeat* keyword argument.  For example,
    ``product(A, repeat=4)`` means the same as ``product(A, A, A, A)``.
 
-   Equivalent to the following except that the actual implementation does not
-   build-up intermediate results in memory::
+   This function is equivalent to the following code, except that the
+   actual implementation does not build up intermediate results in memory::
 
        def product(*args, **kwds):
            pools = map(tuple, args) * kwds.get('repeat', 1)
-           if pools:            
-               result = [[]]
-               for pool in pools:
-                   result = [x+[y] for x in result for y in pool]
-               for prod in result:
-                   yield tuple(prod)
+           result = [[]]
+           for pool in pools:
+               result = [x+[y] for x in result for y in pool]
+           for prod in result:
+               yield tuple(prod)
 
 
 .. function:: repeat(object[, times])
diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst
index cf6f8f8..2e5cae5 100644
--- a/Doc/library/signal.rst
+++ b/Doc/library/signal.rst
@@ -128,12 +128,12 @@
 .. function:: siginterrupt(signalnum, flag)
 
    Change system call restart behaviour: if *flag* is :const:`False`, system calls
-   will be restarted when interrupted by signal *signalnum*, else system calls will
+   will be restarted when interrupted by signal *signalnum*, otherwise system calls will
    be interrupted. Returns nothing. Availability: Unix, Mac (see the man page
    :manpage:`siginterrupt(3)` for further information).
    
    Note that installing a signal handler with :func:`signal` will reset the restart
-   behaviour to interruptible by implicitly calling siginterrupt with a true *flag*
+   behaviour to interruptible by implicitly calling :cfunc:`siginterrupt` with a true *flag*
    value for the given signal.
 
    .. versionadded:: 2.6