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

raymond.hettinger python-checkins at python.org
Tue Mar 17 01:06:05 CET 2009


Author: raymond.hettinger
Date: Tue Mar 17 01:06:05 2009
New Revision: 70426

Log:
Swap the main and alternative proposals.
Also refer to each by their original names (Proposal I and Proposal II).
Explain Guido's issue with 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	Tue Mar 17 01:06:05 2009
@@ -44,46 +44,45 @@
 .. _`Babel`: http://babel.edgewall.org/
 
 
-Main Proposal (from Eric Smith)
-===============================
+Main Proposal (from Nick Coghlan, originally called Proposal I)
+===============================================================
 
-Make both the thousands separator and decimal separator user
-specifiable but not locale aware.  For simplicity, limit the
-choices to a COMMA, DOT, SPACE, APOSTROPHE or UNDERSCORE.
-The SPACE can be either U+0020 or U+00A0.
+A comma will be added to the format() specifier mini-language::
 
-Whenever a separator is followed by a precision, it is a
-decimal separator and an optional separator preceding it is a
-thousands separator.  When the precision is absent, a lone
-specifier means a thousands separator::
+[[fill]align][sign][#][0][width][,][.precision][type]
 
-[[fill]align][sign][#][0][width][tsep][dsep precision]][type]
+The ',' option indicates that commas should be included in the
+output as a thousands separator. As with locales which do not
+use a period as the decimal point, locales which use a
+different convention for digit separation will need to use the
+locale module to obtain appropriate formatting.
 
-Examples::
+The proposal works well with floats, ints, and decimals.
+It also allows easy substitution for other separators.
+For example::
 
-  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'
-  format(1234, "8_d")      -->    '   1_234'
+  format(n, "6,d").replace(",", "_")
 
-This proposal meets mosts needs, but it comes at the expense
-of taking a bit more effort to parse.  Not every possible
-convention is covered, but at least one of the options (spaces
-or underscores) should be readable, understandable, and useful
-to folks from many diverse backgrounds.
+This technique is completely general but it is awkward in the
+one case where the commas and periods need to be swapped::
 
-As shown in the examples, the *width* argument means the total
-length including the thousands separators and decimal separators.
+  format(n, "6,f").replace(",", "X").replace(".", ",").replace("X", ".")
 
-No change is proposed for the locale module.
+The *width* argument means the total length including the commas
+and decimal point::
 
-The thousands separator is defined as shown above for types
-'d', 'e', 'f', 'g', '%', 'E', 'G' and 'F'. To allow future
-extensions, it is undefined for other types: binary, octal,
-hex, character, etc.
+  format(1234, "08,d")     -->    '0001,234'
+  format(1234.5, "08,.1f") -->    '01,234.5'
+
+The ',' option is defined as shown above for types 'd', 'e',
+'f', 'g', 'E', 'G', '%' and 'F'. To allow future extensions, it is
+undefined for other types: binary, octal, hex, character,
+etc.
+
+This proposal has the virtue of being simpler than the alternative
+proposal but is much less flexible and meets the needs of fewer
+users right out of the box.  It is expected that some other
+solution will arise for specifying alternative separators.
 
 
 Current Version of the Mini-Language
@@ -143,44 +142,51 @@
 .. _`COBOL`: http://en.wikipedia.org/wiki/Cobol#Syntactic_features
 
 
-Alternative Proposal (from Nick Coghlan)
-========================================
+Alternative Proposal (from Eric Smith, originally called Proposal II)
+=====================================================================
 
-A comma will be added to the format() specifier mini-language::
-
-[[fill]align][sign][#][0][width][,][.precision][type]
+Make both the thousands separator and decimal separator user
+specifiable but not locale aware.  For simplicity, limit the
+choices to a COMMA, DOT, SPACE, APOSTROPHE or UNDERSCORE.
+The SPACE can be either U+0020 or U+00A0.
 
-The ',' option indicates that commas should be included in the
-output as a thousands separator. As with locales which do not
-use a period as the decimal point, locales which use a
-different convention for digit separation will need to use the
-locale module to obtain appropriate formatting.
+Whenever a separator is followed by a precision, it is a
+decimal separator and an optional separator preceding it is a
+thousands separator.  When the precision is absent, a lone
+specifier means a thousands separator::
 
-The proposal works well with floats, ints, and decimals.
-It also allows easy substitution for other separators.
-For example::
+[[fill]align][sign][#][0][width][tsep][dsep precision]][type]
 
-  format(n, "6,d").replace(",", "_")
+Examples::
 
-This technique is completely general but it is awkward in the
-one case where the commas and periods need to be swapped::
+  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'
+  format(1234, "8_d")      -->    '   1_234'
 
-  format(n, "6,f").replace(",", "X").replace(".", ",").replace("X", ".")
+This proposal meets mosts needs, but it comes at the expense
+of taking a bit more effort to parse.  Not every possible
+convention is covered, but at least one of the options (spaces
+or underscores) should be readable, understandable, and useful
+to folks from many diverse backgrounds.
 
-The *width* argument means the total length including the commas
-and decimal point::
+As shown in the examples, the *width* argument means the total
+length including the thousands separators and decimal separators.
 
-  format(1234, "08,d")     -->    '0001,234'
-  format(1234.5, "08,.1f") -->    '01,234.5'
+No change is proposed for the locale module.
 
-The ',' option is defined as shown above for types 'd', 'e',
-'f', 'g', 'E', 'G', '%' and 'F'. To allow future extensions, it is
-undefined for other types: binary, octal, hex, character,
-etc.
+The thousands separator is defined as shown above for types
+'d', 'e', 'f', 'g', '%', 'E', 'G' and 'F'. To allow future
+extensions, it is undefined for other types: binary, octal,
+hex, character, etc.
 
-This alternative proposal has the virtue of being simpler
-than the main proposal but is much less flexible and meets
-the needs of fewer users right out of the box.
+The drawback to this alternative proposal is the difficulty
+of mentally parsing whether a single separator is a thousands
+separator or decimal separator.  Perhaps it is too arcane
+to link the decimal separator with the precision specifier.
 
 
 Commentary


More information about the Python-checkins mailing list