]> granicus.if.org Git - python/commitdiff
Issue 2648: Add leading zero to money format recipe in the docs.
authorRaymond Hettinger <python@rcn.com>
Thu, 17 Apr 2008 10:48:31 +0000 (10:48 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 17 Apr 2008 10:48:31 +0000 (10:48 +0000)
Doc/library/decimal.rst
Doc/library/itertools.rst

index a79272f5e41225aeab2f3609585bd5f0d128bd7e..a792f411337f54b12885864df4003169d54fee47 100644 (file)
@@ -1426,7 +1426,7 @@ to work with the :class:`Decimal` class::
        >>> moneyfmt(Decimal(123456789), sep=' ')
        '123 456 789.00'
        >>> moneyfmt(Decimal('-0.02'), neg='<', trailneg='>')
-       '<.02>'
+       '<0.02>'
 
        """
        q = Decimal(10) ** -places      # 2 places --> '0.01'
@@ -1439,6 +1439,8 @@ to work with the :class:`Decimal` class::
        for i in range(places):
            build(next() if digits else '0')
        build(dp)
+       if not digits:
+           build('0')
        i = 0
        while digits:
            build(next())
index 4a4db2927c664c432618d72259799eaff5c55eb2..7d7c6ca37299eaa38c6f0641ae1f26856af93486 100644 (file)
@@ -98,7 +98,7 @@ loops that truncate the stream.
 
 .. function:: combinations(iterable, r)
 
-   Return successive *r* length combinations of elements in the *iterable*.
+   Return *r* length subsequences of elements from the input *iterable*.
 
    Combinations are emitted in lexicographic sort order.  So, if the 
    input *iterable* is sorted, the combination tuples will be produced
@@ -108,9 +108,6 @@ loops that truncate the stream.
    value.  So if the input elements are unique, there will be no repeat
    values in each combination.
 
-   Each result tuple is ordered to match the input order.  So, every
-   combination is a subsequence of the input *iterable*.
-
    Equivalent to::
 
         def combinations(iterable, r):
@@ -446,11 +443,10 @@ loops that truncate the stream.
    Equivalent to nested for-loops in a generator expression. For example,
    ``product(A, B)`` returns the same as ``((x,y) for x in A for y in B)``.
 
-   The leftmost iterators correspond to the outermost for-loop, so the output
-   tuples 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.
+   The nested loops cycle like an odometer with the rightmost element advancing
+   on every iteration.  This pattern creats 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,