On 1/17/06, Bob Ippolito bob@redivi.com wrote:
There shouldn't be a %B for the same reason there isn't an %O or %D -- they're all just digits, so there's not a need for an uppercase variant.
Right.
The difference between hex() and oct() and the proposed binary() is
I'd propose bin() to stay in line with the short abbreviated names.
that hex() and oct() return valid Python expressions in that base. In order for it to make sense, Python would need to grow some syntax.
Fair enough. So let's define it.
If Python were to have syntax for binary literals, I'd propose a trailing b: "1100b". It would be convenient at times to represent bit flags, but I'm not sure it's worth the syntax change.
Typically, suffixes are used to indicated *types*: 12L, 12j, and even 12e0 in some sense.
The binary type should have a 0b prefix.
Perhaps this could be implemented at the PyCon sprint?
-- --Guido van Rossum (home page: http://www.python.org/~guido/)