--- rest25/whatsnew/2.4.rst	2008-12-19 16:58:06.000000000 +0900
+++ rest262/whatsnew/2.4.rst	2009-04-05 05:01:47.000000000 +0900
@@ -1,45 +1,44 @@
 ****************************
-  What's New in Python 2.4  
+  What's New in Python 2.4
 ****************************
 
 :Author: A.M. Kuchling
 
 .. |release| replace:: 1.02
 
-.. % $Id: whatsnew24.tex 50936 2006-07-29 15:42:46Z andrew.kuchling $
-.. % Don't write extensive text for new sections; I'll do that.
-.. % Feel free to add commented-out reminders of things that need
-.. % to be covered.  --amk
+.. $Id: whatsnew24.tex 54632 2007-03-31 11:59:54Z georg.brandl $
+.. Don't write extensive text for new sections; I'll do that.
+.. Feel free to add commented-out reminders of things that need
+.. to be covered.  --amk
 
 This article explains the new features in Python 2.4.1, released on March 30,
 2005.
 
 Python 2.4 is a medium-sized release.  It doesn't introduce as many changes as
 the radical Python 2.2, but introduces more features than the conservative 2.3
 release.  The most significant new language features are function decorators and
 generator expressions; most other changes are to the standard library.
 
 According to the CVS change logs, there were 481 patches applied and 502 bugs
 fixed between Python 2.3 and 2.4.  Both figures are likely to be underestimates.
 
 This article doesn't attempt to provide a complete specification of every single
 new feature, but instead provides a brief introduction to each feature.  For
 full details, you should refer to the documentation for Python 2.4, such as the
-Python Library Reference (XXX reference: ../lib/lib.html) and the Python
-Reference Manual (XXX reference: ../ref/ref.html).  Often you will be referred
-to the PEP for a particular new feature for explanations of the implementation
-and design rationale.
+Python Library Reference and the Python Reference Manual.  Often you will be
+referred to the PEP for a particular new feature for explanations of the
+implementation and design rationale.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 218: Built-In Set Objects
 =============================
 
 Python 2.3 introduced the :mod:`sets` module.  C implementations of set data
 types have now been added to the Python core as two new built-in types,
 :func:`set(iterable)` and :func:`frozenset(iterable)`.  They provide high speed
 operations for membership testing, for eliminating duplicates from sequences,
 and for mathematical operations like unions, intersections, differences, and
 symmetric differences. ::
 
@@ -55,70 +54,70 @@
    >>> a - b                               # letters in a but not in b
    set(['r', 'd', 'b'])
    >>> a | b                               # letters in either a or b
    set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])
    >>> a & b                               # letters in both a and b
    set(['a', 'c'])
    >>> a ^ b                               # letters in a or b but not both
    set(['r', 'd', 'b', 'm', 'z', 'l'])
 
    >>> a.add('z')                          # add a new element
    >>> a.update('wxy')                     # add multiple new elements
    >>> a
-   set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])       
+   set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])
    >>> a.remove('x')                       # take one element out
    >>> a
-   set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])       
+   set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])
 
 The :func:`frozenset` type is an immutable version of :func:`set`. Since it is
 immutable and hashable, it may be used as a dictionary key or as a member of
 another set.
 
 The :mod:`sets` module remains in the standard library, and may be useful if you
 wish to subclass the :class:`Set` or :class:`ImmutableSet` classes.  There are
 currently no plans to deprecate the module.
 
 
 .. seealso::
 
    :pep:`218` - Adding a Built-In Set Object Type
       Originally proposed by Greg Wilson and ultimately implemented by Raymond
       Hettinger.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 237: Unifying Long Integers and Integers
 ============================================
 
 The lengthy transition process for this PEP, begun in Python 2.2, takes another
 step forward in Python 2.4.  In 2.3, certain integer operations that would
 behave differently after int/long unification triggered :exc:`FutureWarning`
 warnings and returned values limited to 32 or 64 bits (depending on your
 platform).  In 2.4, these expressions no longer produce a warning and instead
 produce a different result that's usually a long integer.
 
 The problematic expressions are primarily left shifts and lengthy hexadecimal
 and octal constants.  For example, ``2 << 32`` results in a warning in 2.3,
 evaluating to 0 on 32-bit platforms.  In Python 2.4, this expression now returns
 the correct answer, 8589934592.
 
 
 .. seealso::
 
    :pep:`237` - Unifying Long Integers and Integers
       Original PEP written by Moshe Zadka and GvR.  The changes for 2.4 were
       implemented by  Kalle Svensson.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 289: Generator Expressions
 ==============================
 
 The iterator feature introduced in Python 2.2 and the :mod:`itertools` module
 make it easier to write programs that loop through large data sets without
 having the entire data set in memory at one time.  List comprehensions don't fit
 into this picture very well because they produce a Python list object containing
 all of the items.  This unavoidably pulls all of the objects into memory, which
 can be a problem if your data set is very large.  When trying to write a
 functionally-styled program, it would be natural to write something like::
@@ -157,25 +156,25 @@
 Most notably, the loop variable (*obj* in the above example) is not accessible
 outside of the generator expression.  List comprehensions leave the variable
 assigned to its last value; future versions of Python will change this, making
 list comprehensions match generator expressions in this respect.
 
 
 .. seealso::
 
    :pep:`289` - Generator Expressions
       Proposed by Raymond Hettinger and implemented by Jiwon Seo with early efforts
       steered by Hye-Shik Chang.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 292: Simpler String Substitutions
 =====================================
 
 Some new classes in the standard library provide an alternative mechanism for
 substituting variables into strings; this style of substitution may be better
 for applications where untrained users need to edit templates.
 
 The usual way of substituting variables by name is the ``%`` operator::
 
    >>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}
@@ -191,43 +190,37 @@
 helpful feedback to them.
 
 PEP 292 adds a :class:`Template` class to the :mod:`string` module that uses
 ``$`` to indicate a substitution::
 
    >>> import string
    >>> t = string.Template('$page: $title')
    >>> t.substitute({'page':2, 'title': 'The Best of Times'})
    '2: The Best of Times'
 
 If a key is missing from the dictionary, the :meth:`substitute` method will
 raise a :exc:`KeyError`.  There's also a :meth:`safe_substitute` method that
-ignores missing keys:
-
-.. % $ Terminate $-mode for Emacs
-
-::
+ignores missing keys::
 
    >>> t = string.Template('$page: $title')
    >>> t.safe_substitute({'page':3})
    '3: $title'
 
-.. % $ Terminate math-mode for Emacs
-
 
 .. seealso::
 
    :pep:`292` - Simpler String Substitutions
       Written and implemented  by Barry Warsaw.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 318: Decorators for Functions and Methods
 =============================================
 
 Python 2.2 extended Python's object model by adding static methods and class
 methods, but it didn't extend Python's syntax to provide any new way of defining
 static or class methods.  Instead, you had to write a :keyword:`def` statement
 in the usual way, and pass the resulting method to a :func:`staticmethod` or
 :func:`classmethod` function that would wrap up the function as a method of the
 new type. Your code would look like this::
 
@@ -338,84 +331,84 @@
 
 
 .. seealso::
 
    :pep:`318` - Decorators for Functions, Methods and Classes
       Written  by Kevin D. Smith, Jim Jewett, and Skip Montanaro.  Several people
       wrote patches implementing function decorators, but the one that was actually
       checked in was patch #979728, written by Mark Russell.
 
    http://www.python.org/moin/PythonDecoratorLibrary
       This Wiki page contains several examples of decorators.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 322: Reverse Iteration
 ==========================
 
 A new built-in function, :func:`reversed(seq)`, takes a sequence and returns an
 iterator that loops over the elements of the sequence  in reverse order.   ::
 
    >>> for i in reversed(xrange(1,4)):
    ...    print i
-   ... 
+   ...
    3
    2
    1
 
 Compared to extended slicing, such as ``range(1,4)[::-1]``, :func:`reversed` is
 easier to read, runs faster, and uses substantially less memory.
 
 Note that :func:`reversed` only accepts sequences, not arbitrary iterators.  If
 you want to reverse an iterator, first convert it to  a list with :func:`list`.
 ::
 
    >>> input = open('/etc/passwd', 'r')
    >>> for line in reversed(list(input)):
    ...   print line
-   ... 
+   ...
    root:*:0:0:System Administrator:/var/root:/bin/tcsh
      ...
 
 
 .. seealso::
 
    :pep:`322` - Reverse Iteration
       Written and implemented by Raymond Hettinger.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 324: New subprocess Module
 ==============================
 
 The standard library provides a number of ways to execute a subprocess, offering
 different features and different levels of complexity.
 :func:`os.system(command)` is easy to use, but slow (it runs a shell process
 which executes the command) and dangerous (you have to be careful about escaping
 the shell's metacharacters).  The :mod:`popen2` module offers classes that can
 capture standard output and standard error from the subprocess, but the naming
 is confusing.  The :mod:`subprocess` module cleans  this up, providing a unified
 interface that offers all the features you might need.
 
 Instead of :mod:`popen2`'s collection of classes, :mod:`subprocess` contains a
 single class called :class:`Popen`  whose constructor supports a number of
 different keyword arguments. ::
 
    class Popen(args, bufsize=0, executable=None,
-   	    stdin=None, stdout=None, stderr=None,
-   	    preexec_fn=None, close_fds=False, shell=False,
-   	    cwd=None, env=None, universal_newlines=False,
-   	    startupinfo=None, creationflags=0):
+               stdin=None, stdout=None, stderr=None,
+               preexec_fn=None, close_fds=False, shell=False,
+               cwd=None, env=None, universal_newlines=False,
+               startupinfo=None, creationflags=0):
 
 *args* is commonly a sequence of strings that will be the arguments to the
 program executed as the subprocess.  (If the *shell* argument is true, *args*
 can be a string which will then be passed on to the shell for interpretation,
 just as :func:`os.system` does.)
 
 *stdin*, *stdout*, and *stderr* specify what the subprocess's input, output, and
 error streams will be.  You can provide a file object or a file descriptor, or
 you can use the constant ``subprocess.PIPE`` to create a pipe between the
 subprocess and the parent.
 
 The constructor has a number of handy options:
@@ -460,25 +453,25 @@
 
 The PEP takes various examples of shell and Python code and shows how they'd be
 translated into Python code that uses :mod:`subprocess`.  Reading this section
 of the PEP is highly recommended.
 
 
 .. seealso::
 
    :pep:`324` - subprocess - New process module
       Written and implemented by Peter Åstrand, with assistance from Fredrik Lundh and
       others.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 327: Decimal Data Type
 ==========================
 
 Python has always supported floating-point (FP) numbers, based on the underlying
 C :ctype:`double` type, as a data type.  However, while most programming
 languages provide a floating-point type, many people (even programmers) are
 unaware that floating-point numbers don't represent certain decimal fractions
 accurately.  The new :class:`Decimal` type can represent these fractions
 accurately, up to a user-specified precision limit.
 
@@ -648,40 +641,40 @@
   examples of error conditions are division by zero, loss of precision, and
   overflow.
 
 There's a thread-local default context available by calling :func:`getcontext`;
 you can change the properties of this context to alter the default precision,
 rounding, or trap handling.  The following example shows the effect of changing
 the precision of the default context::
 
    >>> decimal.getcontext().prec
    28
    >>> decimal.Decimal(1) / decimal.Decimal(7)
    Decimal("0.1428571428571428571428571429")
-   >>> decimal.getcontext().prec = 9 
+   >>> decimal.getcontext().prec = 9
    >>> decimal.Decimal(1) / decimal.Decimal(7)
    Decimal("0.142857143")
 
 The default action for error conditions is selectable; the module can either
 return a special value such as infinity or not-a-number, or exceptions can be
 raised::
 
    >>> decimal.Decimal(1) / decimal.Decimal(0)
    Traceback (most recent call last):
      ...
    decimal.DivisionByZero: x / 0
    >>> decimal.getcontext().traps[decimal.DivisionByZero] = False
    >>> decimal.Decimal(1) / decimal.Decimal(0)
    Decimal("Infinity")
-   >>> 
+   >>>
 
 The :class:`Context` instance also has various methods for formatting  numbers
 such as :meth:`to_eng_string` and :meth:`to_sci_string`.
 
 For more information, see the documentation for the :mod:`decimal` module, which
 includes a quick-start tutorial and a reference.
 
 
 .. seealso::
 
    :pep:`327` - Decimal Data Type
       Written by Facundo Batista and implemented by Facundo Batista, Eric Price,
@@ -690,25 +683,25 @@
    http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
       A more detailed overview of the IEEE-754 representation.
 
    http://www.lahey.com/float.htm
       The article uses Fortran code to illustrate many of the problems that floating-
       point inaccuracy can cause.
 
    http://www2.hursley.ibm.com/decimal/
       A description of a decimal-based representation.  This representation is being
       proposed as a standard, and underlies the new Python decimal type.  Much of this
       material was written by Mike Cowlishaw, designer of the Rexx language.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 328: Multi-line Imports
 ===========================
 
 One language change is a small syntactic tweak aimed at making it easier to
 import many names from a module.  In a ``from module import names`` statement,
 *names* is a sequence of names separated by commas.  If the sequence is  very
 long, you can either write multiple imports from the same module, or you can use
 backslashes to escape the line endings like this::
 
    from SimpleXMLRPCServer import SimpleXMLRPCServer,\
@@ -726,25 +719,25 @@
                                    resolve_dotted_attribute)
 
 The PEP also proposes that all :keyword:`import` statements be absolute imports,
 with a leading ``.`` character to indicate a relative import.  This part of the
 PEP was not implemented for Python 2.4, but was completed for Python 2.5.
 
 
 .. seealso::
 
    :pep:`328` - Imports: Multi-Line and Absolute/Relative
       Written by Aahz.  Multi-line imports were implemented by Dima Dorfman.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 PEP 331: Locale-Independent Float/String Conversions
 ====================================================
 
 The :mod:`locale` modules lets Python software select various conversions and
 display conventions that are localized to a particular country or language.
 However, the module was careful to not change the numeric locale because various
 functions in Python's implementation required that the numeric locale remain set
 to the ``'C'`` locale.  Often this was because the code was using the C
 library's :cfunc:`atof` function.
 
@@ -754,36 +747,36 @@
 numbers in the current locale.
 
 The solution described in the PEP is to add three new functions to the Python
 API that perform ASCII-only conversions, ignoring the locale setting:
 
 * :cfunc:`PyOS_ascii_strtod(str, ptr)`  and :cfunc:`PyOS_ascii_atof(str, ptr)`
   both convert a string to a C :ctype:`double`.
 
 * :cfunc:`PyOS_ascii_formatd(buffer, buf_len, format, d)` converts a
   :ctype:`double` to an ASCII string.
 
 The code for these functions came from the GLib library
-(`<http://developer.gnome.org/arch/gtk/glib.html>`_), whose developers kindly
+(http://developer.gnome.org/arch/gtk/glib.html), whose developers kindly
 relicensed the relevant functions and donated them to the Python Software
 Foundation.  The :mod:`locale` module  can now change the numeric locale,
 letting extensions such as GTK+  produce the correct results.
 
 
 .. seealso::
 
    :pep:`331` - Locale-Independent Float/String Conversions
       Written by Christian R. Reis, and implemented by Gustavo Carneiro.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 Other Language Changes
 ======================
 
 Here are all of the changes that Python 2.4 makes to the core Python language.
 
 * Decorators for functions and methods were added (:pep:`318`).
 
 * Built-in :func:`set` and :func:`frozenset` types were  added (:pep:`218`).
   Other new built-ins include the :func:`reversed(seq)` function (:pep:`322`).
 
@@ -801,25 +794,25 @@
 
 * The string methods :meth:`ljust`, :meth:`rjust`, and :meth:`center` now take
   an optional argument for specifying a fill character other than a space.
   (Contributed by Raymond Hettinger.)
 
 * Strings also gained an :meth:`rsplit` method that works like the :meth:`split`
   method but splits from the end of the string.   (Contributed by Sean
   Reifschneider.) ::
 
      >>> 'www.python.org'.split('.', 1)
      ['www', 'python.org']
      'www.python.org'.rsplit('.', 1)
-     ['www.python', 'org']        
+     ['www.python', 'org']
 
 * Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the
   :meth:`sort` method of lists. These parameters make some common usages of
   :meth:`sort` simpler. All of these parameters are optional.
 
   For the *cmp* parameter, the value should be a comparison function that takes
   two parameters and returns -1, 0, or +1 depending on how the parameters compare.
   This function will then be used to sort the list.  Previously this was the only
   parameter that could be provided to :meth:`sort`.
 
   *key* should be a single-parameter function that takes a list element and
   returns a comparison key for the element.  The list is then sorted using the
@@ -924,25 +917,25 @@
      []
 
   (Contributed by Raymond Hettinger.)
 
 * Encountering a failure while importing a module no longer leaves a partially-
   initialized module object in ``sys.modules``.  The incomplete module object left
   behind would fool further imports of the same module into succeeding, leading to
   confusing errors.   (Fixed by Tim Peters.)
 
 * :const:`None` is now a constant; code that binds a new value to  the name
   ``None`` is now a syntax error. (Contributed by Raymond Hettinger.)
 
-.. % ======================================================================
+.. ======================================================================
 
 
 Optimizations
 -------------
 
 * The inner loops for list and tuple slicing were optimized and now run about
   one-third faster.  The inner loops for dictionaries were also optimized,
   resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:`items`,
   :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. (Contributed by
   Raymond Hettinger.)
 
 * The machinery for growing and shrinking lists was optimized for speed and for
@@ -975,33 +968,31 @@
   "abc"`` are now performed more efficiently in certain circumstances.  This
   optimization won't be present in other Python implementations such as Jython, so
   you shouldn't rely on it; using the :meth:`join` method of strings is still
   recommended when you want to efficiently glue a large number of strings
   together. (Contributed by Armin Rigo.)
 
 The net result of the 2.4 optimizations is that Python 2.4 runs the pystone
 benchmark around 5% faster than Python 2.3 and 35% faster than Python 2.2.
 (pystone is not a particularly good benchmark, but it's the most commonly used
 measurement of Python's performance.  Your own applications may show greater or
 smaller benefits from Python 2.4.)
 
-.. % pystone is almost useless for comparing different versions of Python;
-.. % instead, it excels at predicting relative Python performance on
-.. % different machines.
-.. % So, this section would be more informative if it used other tools
-.. % such as pybench and parrotbench.  For a more application oriented
-.. % benchmark, try comparing the timings of test_decimal.py under 2.3
-.. % and 2.4.
+.. pystone is almost useless for comparing different versions of Python;
+   instead, it excels at predicting relative Python performance on different
+   machines.  So, this section would be more informative if it used other tools
+   such as pybench and parrotbench.  For a more application oriented benchmark,
+   try comparing the timings of test_decimal.py under 2.3 and 2.4.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 New, Improved, and Deprecated Modules
 =====================================
 
 As usual, Python's standard library received a number of enhancements and bug
 fixes.  Here's a partial list of the most notable changes, sorted alphabetically
 by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more
 complete list of changes, or look through the CVS logs for all the details.
 
 * The :mod:`asyncore` module's :func:`loop` function now has a *count* parameter
   that lets you perform a limited number of passes through the polling loop.  The
@@ -1045,25 +1036,25 @@
      >>> d = deque('ghi')        # make a new deque with three items
      >>> d.append('j')           # add a new entry to the right side
      >>> d.appendleft('f')       # add a new entry to the left side
      >>> d                       # show the representation of the deque
      deque(['f', 'g', 'h', 'i', 'j'])
      >>> d.pop()                 # return and remove the rightmost item
      'j'
      >>> d.popleft()             # return and remove the leftmost item
      'f'
      >>> list(d)                 # list the contents of the deque
      ['g', 'h', 'i']
      >>> 'h' in d                # search the deque
-     True  
+     True
 
   Several modules, such as the :mod:`Queue` and :mod:`threading` modules, now take
   advantage of :class:`collections.deque` for improved performance.  (Contributed
   by Raymond Hettinger.)
 
 * The :mod:`ConfigParser` classes have been enhanced slightly. The :meth:`read`
   method now returns a list of the files that were successfully parsed, and the
   :meth:`set` method raises :exc:`TypeError` if passed a *value* argument that
   isn't a string.   (Contributed by John Belmonte and David Goodger.)
 
 * The :mod:`curses` module now supports the ncurses extension
   :func:`use_default_colors`.  On platforms where the terminal supports
@@ -1106,94 +1097,94 @@
   itself.  :func:`groupby` then groups the elements into subsequences which have
   matching values of the key, and returns a series of 2-tuples containing the key
   value and an iterator over the subsequence.
 
   Here's an example to make this clearer.  The *key* function simply returns
   whether a number is even or odd, so the result of :func:`groupby` is to return
   consecutive runs of odd or even numbers. ::
 
      >>> import itertools
      >>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]
      >>> for key_val, it in itertools.groupby(L, lambda x: x % 2):
      ...    print key_val, list(it)
-     ... 
+     ...
      0 [2, 4, 6]
      1 [7]
      0 [8]
      1 [9, 11]
      0 [12, 14]
-     >>> 
+     >>>
 
   :func:`groupby` is typically used with sorted input.  The logic for
   :func:`groupby` is similar to the Unix ``uniq`` filter which makes it handy for
   eliminating, counting, or identifying duplicate elements::
 
      >>> word = 'abracadabra'
      >>> letters = sorted(word)   # Turn string into a sorted list of letters
-     >>> letters 
+     >>> letters
      ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']
      >>> for k, g in itertools.groupby(letters):
      ...    print k, list(g)
-     ... 
+     ...
      a ['a', 'a', 'a', 'a', 'a']
      b ['b', 'b']
      c ['c']
      d ['d']
      r ['r', 'r']
      >>> # List unique letters
-     >>> [k for k, g in groupby(letters)]                     
+     >>> [k for k, g in groupby(letters)]
      ['a', 'b', 'c', 'd', 'r']
      >>> # Count letter occurrences
-     >>> [(k, len(list(g))) for k, g in groupby(letters)]     
+     >>> [(k, len(list(g))) for k, g in groupby(letters)]
      [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]
 
   (Contributed by Hye-Shik Chang.)
 
 * :mod:`itertools` also gained a function named :func:`tee(iterator, N)` that
   returns *N* independent iterators that replicate *iterator*.  If *N* is omitted,
   the default is 2. ::
 
      >>> L = [1,2,3]
      >>> i1, i2 = itertools.tee(L)
      >>> i1,i2
      (<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>)
      >>> list(i1)               # Run the first iterator to exhaustion
      [1, 2, 3]
      >>> list(i2)               # Run the second iterator to exhaustion
      [1, 2, 3]
-     >
+
   Note that :func:`tee` has to keep copies of the values returned  by the
   iterator; in the worst case, it may need to keep all of them.   This should
   therefore be used carefully if the leading iterator can run far ahead of the
   trailing iterator in a long stream of inputs. If the separation is large, then
   you might as well use  :func:`list` instead.  When the iterators track closely
   with one another, :func:`tee` is ideal.  Possible applications include
   bookmarking, windowing, or lookahead iterators. (Contributed by Raymond
   Hettinger.)
 
 * A number of functions were added to the :mod:`locale`  module, such as
   :func:`bind_textdomain_codeset` to specify a particular encoding and a family of
   :func:`l\*gettext` functions that return messages in the chosen encoding.
   (Contributed by Gustavo Niemeyer.)
 
 * Some keyword arguments were added to the :mod:`logging` package's
   :func:`basicConfig` function to simplify log configuration.  The default
   behavior is to log messages to standard error, but various keyword arguments can
   be specified to log to a particular file, change the logging format, or set the
   logging level. For example::
 
      import logging
      logging.basicConfig(filename='/var/log/application.log',
          level=0,  # Log all messages
-         format='%(levelname):%(process):%(thread):%(message)')	            
+         format='%(levelname):%(process):%(thread):%(message)')
 
   Other additions to the :mod:`logging` package include a :meth:`log(level, msg)`
   convenience method, as well as a :class:`TimedRotatingFileHandler` class that
   rotates its log files at a timed interval.  The module already had
   :class:`RotatingFileHandler`, which rotated logs once the file exceeded a
   certain size.  Both classes derive from a new :class:`BaseRotatingHandler` class
   that can be used to implement other rotating handlers.
 
   (Changes implemented by Vinay Sajip.)
 
 * The :mod:`marshal` module now shares interned strings on unpacking a  data
   structure.  This may shrink the size of certain pickle strings, but the primary
@@ -1314,51 +1305,51 @@
 * The :mod:`weakref` module now supports a wider variety of objects including
   Python functions, class instances, sets, frozensets, deques, arrays, files,
   sockets, and regular expression pattern objects. (Contributed by Raymond
   Hettinger.)
 
 * The :mod:`xmlrpclib` module now supports a multi-call extension for
   transmitting multiple XML-RPC calls in a single HTTP operation. (Contributed by
   Brian Quinlan.)
 
 * The :mod:`mpz`, :mod:`rotor`, and :mod:`xreadlines` modules have  been
   removed.
 
-.. % ======================================================================
-.. % whole new modules get described in subsections here
-.. % =====================
+.. ======================================================================
+.. whole new modules get described in subsections here
+.. =====================
 
 
 cookielib
 ---------
 
 The :mod:`cookielib` library supports client-side handling for HTTP cookies,
 mirroring the :mod:`Cookie` module's server-side cookie support. Cookies are
 stored in cookie jars; the library transparently stores cookies offered by the
 web server in the cookie jar, and fetches the cookie from the jar when
 connecting to the server. As in web browsers, policy objects control whether
 cookies are accepted or not.
 
 In order to store cookies across sessions, two implementations of cookie jars
 are provided: one that stores cookies in the Netscape format so applications can
 use the Mozilla or Lynx cookie files, and one that stores cookies in the same
 format as the Perl libwww library.
 
 :mod:`urllib2` has been changed to interact with :mod:`cookielib`:
 :class:`HTTPCookieProcessor` manages a cookie jar that is used when accessing
 URLs.
 
 This module was contributed by John J. Lee.
 
-.. % ==================
+.. ==================
 
 
 doctest
 -------
 
 The :mod:`doctest` module underwent considerable refactoring thanks to Edward
 Loper and Tim Peters.  Testing can still be as simple as running
 :func:`doctest.testmod`, but the refactorings allow customizing the module's
 operation in various ways
 
 The new :class:`DocTestFinder` class extracts the tests from a given  object's
 docstrings::
@@ -1428,36 +1419,36 @@
    is
    a
    lengthy
    >>>"""
        L = 'here is a rather lengthy list of words'.split()
        for word in L[:n]:
            print word
 
 Running the above function's tests with :const:`doctest.REPORT_UDIFF` specified,
 you get the following output::
 
    **********************************************************************
-   File ``t.py'', line 15, in g
+   File "t.py", line 15, in g
    Failed example:
        g(4)
    Differences (unified diff with -expected +actual):
        @@ -2,3 +2,3 @@
         is
         a
        -lengthy
        +rather
    **********************************************************************
 
-.. % ======================================================================
+.. ======================================================================
 
 
 Build and C API Changes
 =======================
 
 Some of the changes to Python's build process and to the C API are:
 
 * Three new convenience macros were added for common return values from
   extension functions: :cmacro:`Py_RETURN_NONE`, :cmacro:`Py_RETURN_TRUE`, and
   :cmacro:`Py_RETURN_FALSE`. (Contributed by Brett Cannon.)
 
 * Another new macro, :cmacro:`Py_CLEAR(obj)`,  decreases the reference count of
@@ -1492,34 +1483,34 @@
   intended as an aid to people developing the Python core.  Providing
   :option:`----enable-profiling` to the :program:`configure` script will let you
   profile the interpreter with :program:`gprof`, and providing the
   :option:`----with-tsc` switch enables profiling using the Pentium's Time-Stamp-
   Counter register.  Note that the :option:`----with-tsc` switch is slightly
   misnamed, because the profiling feature also works on the PowerPC platform,
   though that processor architecture doesn't call that register "the TSC
   register".  (Contributed by Jeremy Hylton.)
 
 * The :ctype:`tracebackobject` type has been renamed to
   :ctype:`PyTracebackObject`.
 
-.. % ======================================================================
+.. ======================================================================
 
 
 Port-Specific Changes
 ---------------------
 
 * The Windows port now builds under MSVC++ 7.1 as well as version 6.
   (Contributed by Martin von Löwis.)
 
-.. % ======================================================================
+.. ======================================================================
 
 
 Porting to Python 2.4
 =====================
 
 This section lists previously described changes that may require changes to your
 code:
 
 * Left shifts and hexadecimal/octal constants that are too  large no longer
   trigger a :exc:`FutureWarning` and return  a value limited to 32 or 64 bits;
   instead they return a long integer.
 
@@ -1548,25 +1539,25 @@
 * The :mod:`tarfile` module now generates GNU-format tar files by default.
 
 * Encountering a failure while importing a module no longer leaves a partially-
   initialized module object in ``sys.modules``.
 
 * :const:`None` is now a constant; code that binds a new value to  the name
   ``None`` is now a syntax error.
 
 * The :func:`signals.signal` function now raises a :exc:`RuntimeError` exception
   for certain illegal values; previously these errors would pass silently.  For
   example, you can no longer set a handler on the :const:`SIGKILL` signal.
 
-.. % ======================================================================
+.. ======================================================================
 
 
-.. _acks:
+.. _24acks:
 
 Acknowledgements
 ================
 
 The author would like to thank the following people for offering suggestions,
 corrections and assistance with various drafts of this article: Koray Can, Hye-
 Shik Chang, Michael Dyck, Raymond Hettinger, Brian Hurt, Hamish Lawson, Fredrik
 Lundh, Sean Reifschneider, Sadruddin Rejeb.
 
