[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-08 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

See r87856

--
resolution:  - accepted
status: open - closed
type:  - feature request
versions: +Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-07 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
priority: normal - low

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-06 Thread Carsten Grohmann

Carsten Grohmann carstengrohm...@gmx.de added the comment:

Setting dp to an empty string is only a workaround from my perspective.

I get the value of the places parameter from a configuration instance and have 
to implement an additional check places == 0 every time I call the original 
moneyfmt(). To reduce this effort I've changed my moneyfmt() function and 
applied the patch above.

I see only a valuable posibilities from my perspective: apply the patch. 
Because it would simplify life a little bit :-)

At end it's up to you because the current documentation stated dp: ... only 
specify as blank when places is zero.

Regards,
Carsten

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-05 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

I think I prefer the code as-is.  If you need to blank out the decimal point, 
set dp to the empty string.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-03 Thread Carsten Grohmann

New submission from Carsten Grohmann carstengrohm...@gmx.de:

Hi,

the documentation of the decimal module contains a small recipe called 
moneyfmt() for format decimal values. It's very usefull.

I'd like to suggest a small improvement because the output is incorrect with 
given dp=. (default) and places=0.

Example:
 moneyfmt(decimal.Decimal('-0.02'), neg='', trailneg='', places=1)
'0.0'
 moneyfmt(decimal.Decimal('-0.02'), neg='', trailneg='', places=0)
'0.'

Change:
--- moneyfmt.py 2011-01-03 13:56:32.774169788 +0100
+++ moneyfmt.py.new 2011-01-03 13:56:58.130165330 +0100
@@ -33,7 +33,8 @@
 build(trailneg)
 for i in range(places):
 build(next() if digits else '0')
-build(dp)
+if places:
+build(dp)
 if not digits:
 build('0')
 i = 0

What do you think about the change?

Regrads,
Carsten

--
assignee: d...@python
components: Documentation
messages: 125164
nosy: cgrohmann, d...@python
priority: normal
severity: normal
status: open
title: Suppress adding decimal point for places=0 in moneyfmt()

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10813] Suppress adding decimal point for places=0 in moneyfmt()

2011-01-03 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee: d...@python - rhettinger
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com