[Python-checkins] r62376 - peps/trunk/pep-3127.txt
eric.smith
python-checkins at python.org
Fri Apr 18 20:46:07 CEST 2008
Author: eric.smith
Date: Fri Apr 18 20:46:07 2008
New Revision: 62376
Log:
Removed %b formatting from string % operator. Because
% formatting will be deprecated in favor of str.format(),
we don't want to be adding features it.
Modified:
peps/trunk/pep-3127.txt
Modified: peps/trunk/pep-3127.txt
==============================================================================
--- peps/trunk/pep-3127.txt (original)
+++ peps/trunk/pep-3127.txt Fri Apr 18 20:46:07 2008
@@ -128,13 +128,14 @@
Output formatting
-----------------
-The string (and unicode in 2.6) % operator will have
-'b' format specifier added for binary in both 2.6 and 3.0.
-In 3.0, the alternate syntax of the 'o' option will need to
-be updated to add '0o' in front, instead of '0'. In 2.6,
-alternate octal formatting will continue to add only '0'.
-
-PEP 3101 already supports 'b' for binary output.
+In 3.0, the string % operator alternate syntax for the 'o'
+option will need to be updated to add '0o' in front,
+instead of '0'. In 2.6, alternate octal formatting will
+continue to add only '0'. In neither 2.6 nor 3.0 will
+the % operator support binary output. This is because
+binary output is already supported by PEP 3101
+(str.format), which is the prefered string formatting
+method.
Transition from 2.6 to 3.0
@@ -437,9 +438,9 @@
with the "x" for "heXadecimal".
For the string % operator, "o" was already being used to denote
-octal, and "b" was not used for anything, so this works out
-much better than, for example, using "c" (which means "character"
-for the % operator).
+octal. Binary formatting is not being added to the % operator
+because PEP 3101 (Advanced String Formatting) already supports
+binary, % formatting will be deprecated in the future.
At the end of the day, since uppercase "O" can look like a zero
and uppercase "B" can look like an 8, it was decided that these
@@ -465,7 +466,7 @@
and there would need to be a consensus that there is a valid
use-case for the "alternate form" of the string % operator
to support uppercase 'B' or 'O' characters for binary or
-octal output. Currently, PEP3101 does not even support this
+octal output. Currently, PEP 3101 does not even support this
alternate capability, and the hex() function does not allow
the programmer to specify the case of the 'x' character.
More information about the Python-checkins
mailing list