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

raymond.hettinger python-checkins at python.org
Thu Mar 12 20:36:28 CET 2009


Author: raymond.hettinger
Date: Thu Mar 12 20:36:28 2009
New Revision: 70330

Log:
Add research on what C Sharp does.

Modified:
   peps/trunk/pep-0378.txt

Modified: peps/trunk/pep-0378.txt
==============================================================================
--- peps/trunk/pep-0378.txt	(original)
+++ peps/trunk/pep-0378.txt	Thu Mar 12 20:36:28 2009
@@ -60,10 +60,12 @@
 
     "_($* #,##0_)".
 
-COBOL uses picture clauses like::
+`COBOL`_ uses picture clauses like::
 
     PIC $***,**9.99CR
 
+.. _`COBOL`: http://en.wikipedia.org/wiki/Cobol
+
 `Common Lisp`_ uses a COLON before the ``~D`` decimal type specifier to
 emit a COMMA as a thousands separator.  The  general form of ``~D`` is
 ``~mincol,padchar,commachar,commaintervalD``.  The *padchar* defaults
@@ -76,6 +78,17 @@
 
 .. _`Common Lisp`: http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html
 
+`C-Sharp`_ provides both styles (picture formatting and type specifiers).
+The type specifier approach is locale aware.  The picture formatting only
+offers a COMMA as a thousands separator::
+
+    String.Format("{0:c}", 12400)   ==>   "$12,400"
+    String.Format("{0:n}", 12400)   ==>    "12,400"
+    String.Format("{0:0,0}", 12400)   ==>  "12,400"
+
+.. _`C-Sharp`: http://blog.stevex.net/index.php/string-formatting-in-csharp/
+
+
 Proposal I (from Nick Coghlan)
 ==============================
 


More information about the Python-checkins mailing list