[Python-checkins] r70340 - peps/trunk/pep-0378.txt

raymond.hettinger python-checkins at python.org
Fri Mar 13 03:55:14 CET 2009


Author: raymond.hettinger
Date: Fri Mar 13 03:55:13 2009
New Revision: 70340

Log:
Merge Eric's proposal into proposal II.

Modified:
   peps/trunk/pep-0378.txt

Modified: peps/trunk/pep-0378.txt
==============================================================================
--- peps/trunk/pep-0378.txt	(original)
+++ peps/trunk/pep-0378.txt	Fri Mar 13 03:55:13 2009
@@ -119,23 +119,29 @@
   format(1234.5, "08,.1f") -->    '01,234.5'
 
 
-Proposal II (to meet Antoine Pitrou's request)
-==============================================
+Proposal II (from Eric Smith)
+=============================
 
 Make both the thousands separator and decimal separator user
 specifiable but not locale aware.  For simplicity, limit the
-choices to a comma, period, space, or underscore.
+choices to a COMMA, DOT, SPACE, or UNDERSCORE.
 
-[[fill]align][sign][#][0][width][T[tsep]][dsep precision][type]
+Whenever the separator is followed by a precision, it is a
+decimal separator and the optional separator preceding it is a
+thousands separator.  When the precision is absent, the
+context is integral and a lone specifier means a thousands
+separator::
+
+[[fill]align][sign][#][0][width][tsep|([tsep] dsep precision)][type]
 
 Examples::
 
-  format(1234, "8.1f")    -->     '  1234.0'
-  format(1234, "8,1f")    -->     '  1234,0'
-  format(1234, "8T.,1f")  -->     ' 1.234,0'
-  format(1234, "8T ,f")   -->     ' 1 234,0'
-  format(1234, "8d")      -->     '    1234'
-  format(1234, "8T,d")    -->     '   1,234'
+  format(1234, "8.1f")     -->    '  1234.0'
+  format(1234, "8,1f")     -->    '  1234,0'
+  format(1234, "8.,1f")    -->    ' 1.234,0'
+  format(1234, "8 ,f")     -->    ' 1 234,0'
+  format(1234, "8d")       -->    '    1234'
+  format(1234, "8,d")      -->    '   1,234'
 
 This proposal meets mosts needs (except for people wanting
 grouping for hundreds or ten-thousands), but it comes at the
@@ -150,34 +156,6 @@
 No change is proposed for the locale module.
 
 
-Proposal III (from Eric Smith: like II but without the T)
-=========================================================
-
-In the second proposal, the *T* isn't strictly necessary.
-In the context of an integer, an optional single specifier means
-a thousands separator.  In the context of a float, a single
-specifier is a decimal separator while two specifiers are taken
-as a thousands separator and a decimal separator::
-
-[[fill]align][sign][#][0][width][tsep][dsep precision][type]
-
-Examples::
-
-  format(1234, "8.1f")    -->     '  1234.0'
-  format(1234, "8,1f")    -->     '  1234,0'
-  format(1234, "8.,1f")   -->     ' 1.234,0'
-  format(1234, "8 ,f")    -->     ' 1 234,0'
-  format(1234, "8d")      -->     '    1234'
-  format(1234, "8,d")     -->     '   1,234'
-
-This is a cleaner looking syntax but has the minor disadvantage of
-using context to direct the translation.  Whenever the separator
-is followed by a precision, it is a decimal separator and the separator
-preceding it is a thousands separator.  When the precision is
-absent, the context is integral and a lone specifier means
-a thousands separator.
-
-
 Other Ideas
 ===========
 


More information about the Python-checkins mailing list