Clarify what width means when thousands separators are present.

This commit is contained in:
Raymond Hettinger 2009-03-12 23:33:12 +00:00
parent b0b34d7ed5
commit 524c658ed5
1 changed files with 9 additions and 0 deletions

View File

@ -112,6 +112,12 @@ one case where the commas and periods need to be swapped::
format(n, "6,f").replace(",", "X").replace(".", ",").replace("X", ".")
The *width* argument means the total length including the commas
and decimal point::
format(1234, "08,d") --> '0001,234'
format(1234.5, "08,.1f") --> '01,234.5'
Proposal II (to meet Antoine Pitrou's request)
==============================================
@ -138,6 +144,9 @@ remember. Also, it makes it more challenging to write custom
__format__ methods that follow the format specification
mini-language.
As shown in the examples, the *width* argument means the total
length including the thousands separators and decimal separators.
No change is proposed for the locale module.