[Python-Dev] str with base

Donovan Baarda abo at minkirri.apana.org.au
Wed Jan 18 13:16:20 CET 2006


On Tue, 2006年01月17日 at 20:25 -0800, Guido van Rossum wrote:
> On 1/17/06, Bob Ippolito <bob at 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
[...]
so %b is "binary",
+1
> > The difference between hex() and oct() and the proposed binary() is
>> I'd propose bin() to stay in line with the short abbreviated names.
[...]
+1
> The binary type should have a 0b prefix.
[...]
+1
For those who argue "who would ever use it?", I would :-) 
Note that this does not support and is independent of supporting
arbitrary bases. I don't think we need to support arbitrary bases, but
if we did I would vote for ".precision" to mean ".base" for "%d"... ie;
"%3.3d" % 5 == " 12"
I think supporting arbitrary bases for floats is way overkill and not
worth considering.
-- 
Donovan Baarda <abo at minkirri.apana.org.au>
http://minkirri.apana.org.au/~abo/


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /