1. Armin Rigo
  2. cpython-withatomic

Commits

Raymond Hettinger  committed 1576e84

SF bug #1071566: moneyfmt recipe in decimal documentation has error

  • Participants
  • Parent commits c10adba
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Doc/lib/libdecimal.tex

View file
     '1.234.568-'
     >>> moneyfmt(d, curr='$', neg='(', trailneg=')')
     '($1,234,567.89)'
+    >>> moneyfmt(Decimal(123456))
+    '123,456.00'
     
     """
     q = Decimal((0, (1,), -places))    # 2 places --> '0.01'
     while digits:
         build(next())
         i += 1
-        if i == 3:
+        if i == 3 and digits:
             i = 0
             build(sep)
     build(curr)