[Python-checkins] r47233 - peps/trunk/pep-3101.txt

talin python-checkins at python.org
Wed Jul 5 02:51:40 CEST 2006


Author: talin
Date: Wed Jul  5 02:51:40 2006
New Revision: 47233

Modified:
   peps/trunk/pep-3101.txt
Log:
Updates to PEP 3101 as a result of discussion in Python-3000


Modified: peps/trunk/pep-3101.txt
==============================================================================
--- peps/trunk/pep-3101.txt	(original)
+++ peps/trunk/pep-3101.txt	Wed Jul  5 02:51:40 2006
@@ -169,12 +169,12 @@
         "My name is {0:8}".format('Fred')
 
     The meaning and syntax of the conversion specifiers depends on the
-    type of object that is being formatted, however many of the
-    built-in types will recognize a standard set of conversion
-    specifiers.
+    type of object that is being formatted, however there is a
+    standard set of conversion specifiers used for any object that
+    does not override them.
 
     Conversion specifiers can themselves contain replacement fields.
-    For example, a field whose field width it itself a parameter
+    For example, a field whose field width is itself a parameter
     could be specified via:
     
         "{0:{1}}".format(a, b, c)
@@ -184,12 +184,12 @@
     the '{{' and '}}' syntax for escapes is only applied when used
     *outside* of a format field. Within a format field, the brace
     characters always have their normal meaning.
-    
-    The syntax for conversion specifiers is open-ended, since except
-    than doing field replacements, the format() method does not
-    attempt to interpret them in any way; it merely passes all of the
-    characters between the first colon and the matching brace to
-    the various underlying formatter methods.
+
+    The syntax for conversion specifiers is open-ended, since a class
+    can override the standard conversion specifiers. In such cases,
+    the format() method merely passes all of the characters between
+    the first colon and the matching brace to the relevant underlying
+    formatting method.
 
 
 Standard Conversion Specifiers
@@ -206,7 +206,7 @@
 
         [[fill]align][sign][width][.precision][type]
 
-    The brackets ([]) indicate an optional field.
+    The brackets ([]) indicate an optional element.
     
     Then the optional align flag can be one of the following:
 
@@ -214,8 +214,8 @@
               space (This is the default.)
         '>' - Forces the field to be right-aligned within the
               available space.
-        '=' - Forces the padding to be placed between immediately
-              after the sign, if any. This is used for printing fields
+        '=' - Forces the padding to be placed after the sign (if any)
+              but before the digits. This is used for printing fields
               in the form '+000000120'.
               
     Note that unless a minimum field width is defined, the field
@@ -229,7 +229,7 @@
     specifier). A zero fill character without an alignment flag
     implies an alignment type of '='.
     
-    The 'sign' field can be one of the following:
+    The 'sign' element can be one of the following:
 
         '+'  - indicates that a sign should be used for both
                positive as well as negative numbers
@@ -244,9 +244,12 @@
     not specified, then the field width will be determined by the
     content.
 
-    The 'precision' field is a decimal number indicating how many
-    digits should be displayed after the decimal point.
-
+    The 'precision' is a decimal number indicating how many digits
+    should be displayed after the decimal point in a floating point
+    conversion. In a string conversion the field indicates how many
+    characters will be used from the field content. The precision is
+    ignored for integer conversions.
+    
     Finally, the 'type' determines how the data should be presented.
     If the type field is absent, an appropriate type will be assigned
     based on the value to be formatted ('d' for integers and longs,


More information about the Python-checkins mailing list