[ python-Bugs-1071566 ] moneyfmt recipe in decimal documentation
has error
SourceForge.net
noreply at sourceforge.net
Tue Nov 23 10:56:28 CET 2004
Bugs item #1071566, was opened at 2004-11-23 10:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1071566&group_id=5470
Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Anna Ravenscroft (annarave)
Assigned to: Nobody/Anonymous (nobody)
Summary: moneyfmt recipe in decimal documentation has error
Initial Comment:
In the new 2.4c1 documentation for decimal, section
5.6.7 Recipes, there is a moneyfmt function - which
mostly works pretty well. It adds a separator between
every 3 digits.
Unfortunately, it adds the separator even when there
are no further digits. So, for example, you can end up
with:
$,437.00
instead of
$437.00
I propose a simple fix:
while digits:
append(next())
i += 1
if i % 3 == 0: append(sep)
if result[-1] == sep: result.pop() # add this line
This would make the moneyfmt function much more usable.
Anna
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1071566&group_id=5470
More information about the Python-bugs-list
mailing list