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.
This commit is contained in:
Eric Smith 2008-04-18 18:46:07 +00:00
parent 8c51c0f26c
commit 68fc50a4cd
1 changed files with 12 additions and 11 deletions

View File

@ -128,13 +128,14 @@ the octal digits (for 3.0, and 2.6 compatibility mode).
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 @@ to use a "t" for "ocTal" and an "n" for "biNary" to go along
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 @@ ample precedence for case sensitivity in the output format string,
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.