Merged revisions 59952-59984 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r59952 | thomas.heller | 2008-01-14 02:35:28 -0800 (Mon, 14 Jan 2008) | 1 line

  Issue 1821: configure libffi for amd64 on FreeeBSD.
........
  r59953 | andrew.kuchling | 2008-01-14 06:48:43 -0800 (Mon, 14 Jan 2008) | 1 line

  Update description of float_info
........
  r59959 | raymond.hettinger | 2008-01-14 14:58:05 -0800 (Mon, 14 Jan 2008) | 1 line

  Fix 1698398:  Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object.
........
  r59961 | andrew.kuchling | 2008-01-14 17:29:16 -0800 (Mon, 14 Jan 2008) | 1 line

  Typo fixes
........
  r59962 | andrew.kuchling | 2008-01-14 17:29:44 -0800 (Mon, 14 Jan 2008) | 1 line

  Markup fix
........
  r59963 | andrew.kuchling | 2008-01-14 17:47:32 -0800 (Mon, 14 Jan 2008) | 1 line

  Add many items
........
  r59964 | andrew.kuchling | 2008-01-14 17:55:32 -0800 (Mon, 14 Jan 2008) | 1 line

  Repair unfinished sentence
........
  r59967 | raymond.hettinger | 2008-01-14 19:02:37 -0800 (Mon, 14 Jan 2008) | 5 lines

  Issue 1820:  structseq objects did not work with the % formatting operator or isinstance(t, tuple).

  Orignal patch (without tests) by Leif Walsh.
........
  r59968 | raymond.hettinger | 2008-01-14 19:07:42 -0800 (Mon, 14 Jan 2008) | 1 line

  Tighten the definition of a named tuple.
........
  r59969 | skip.montanaro | 2008-01-14 19:40:20 -0800 (Mon, 14 Jan 2008) | 3 lines

  Better (?) text describing the lack of guarantees provided by qsize(),
  empty() and full().
........
  r59970 | raymond.hettinger | 2008-01-14 21:39:59 -0800 (Mon, 14 Jan 2008) | 1 line

  Temporarily revert 59967 until GC can be added.
........
  r59971 | raymond.hettinger | 2008-01-14 21:46:43 -0800 (Mon, 14 Jan 2008) | 1 line

  Small grammar nit
........
  r59972 | georg.brandl | 2008-01-14 22:55:56 -0800 (Mon, 14 Jan 2008) | 2 lines

  Typo.
........
  r59973 | georg.brandl | 2008-01-14 22:58:15 -0800 (Mon, 14 Jan 2008) | 2 lines

  Remove duplicate entry.
........
  r59974 | jeffrey.yasskin | 2008-01-14 23:46:24 -0800 (Mon, 14 Jan 2008) | 12 lines

  Add rational.Rational as an implementation of numbers.Rational with infinite
  precision. This has been discussed at http://bugs.python.org/issue1682. It's
  useful primarily for teaching, but it also demonstrates how to implement a
  member of the numeric tower, including fallbacks for mixed-mode arithmetic.

  I expect to write a couple more patches in this area:
   * Rational.from_decimal()
   * Rational.trim/approximate() (maybe with different names)
   * Maybe remove the parentheses from Rational.__str__()
   * Maybe rename one of the Rational classes
   * Maybe make Rational('3/2') work.
........
  r59978 | andrew.kuchling | 2008-01-15 06:38:05 -0800 (Tue, 15 Jan 2008) | 8 lines

  Restore description of sys.dont_write_bytecode.

  The duplication is intentional -- this paragraph is in a section
  describing additions to the sys module, and there's a later section
  that mentions the switch.  I think most people scan the what's-new and
  don't read it in detail, so a bit of duplication is OK.
........
  r59984 | guido.van.rossum | 2008-01-15 09:59:29 -0800 (Tue, 15 Jan 2008) | 3 lines

  Issue #1786 (by myself): pdb should use its own stdin/stdout around an
  exec call and when creating a recursive instance.
........
diff --git a/Doc/library/rational.rst b/Doc/library/rational.rst
new file mode 100644
index 0000000..dd18305
--- /dev/null
+++ b/Doc/library/rational.rst
@@ -0,0 +1,65 @@
+
+:mod:`rational` --- Rational numbers
+====================================
+
+.. module:: rational
+   :synopsis: Rational numbers.
+.. moduleauthor:: Jeffrey Yasskin <jyasskin at gmail.com>
+.. sectionauthor:: Jeffrey Yasskin <jyasskin at gmail.com>
+.. versionadded:: 2.6
+
+
+The :mod:`rational` module defines an immutable, infinite-precision
+Rational number class.
+
+
+.. class:: Rational(numerator=0, denominator=1)
+           Rational(other_rational)
+
+   The first version requires that *numerator* and *denominator* are
+   instances of :class:`numbers.Integral` and returns a new
+   ``Rational`` representing ``numerator/denominator``. If
+   *denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The
+   second version requires that *other_rational* is an instance of
+   :class:`numbers.Rational` and returns an instance of
+   :class:`Rational` with the same value.
+
+   Implements all of the methods and operations from
+   :class:`numbers.Rational` and is hashable.
+
+
+.. method:: Rational.from_float(flt)
+
+   This classmethod constructs a :class:`Rational` representing the
+   exact value of *flt*, which must be a :class:`float`. Beware that
+   ``Rational.from_float(0.3)`` is not the same value as ``Rational(3,
+   10)``
+
+
+.. method:: Rational.__floor__()
+
+   Returns the greatest :class:`int` ``<= self``. Will be accessible
+   through :func:`math.floor` in Py3k.
+
+
+.. method:: Rational.__ceil__()
+
+   Returns the least :class:`int` ``>= self``. Will be accessible
+   through :func:`math.ceil` in Py3k.
+
+
+.. method:: Rational.__round__()
+            Rational.__round__(ndigits)
+
+   The first version returns the nearest :class:`int` to ``self``,
+   rounding half to even. The second version rounds ``self`` to the
+   nearest multiple of ``Rational(1, 10**ndigits)`` (logically, if
+   ``ndigits`` is negative), again rounding half toward even. Will be
+   accessible through :func:`round` in Py3k.
+
+
+.. seealso::
+
+   Module :mod:`numbers`
+      The abstract base classes making up the numeric tower.
+