[Python-Dev] str with base

Bob Ippolito bob at redivi.com
Thu Jan 19 08:58:01 CET 2006


On Jan 18, 2006, at 11:37 PM, Neal Norwitz wrote:

> On 1/18/06, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
>> Guido, we may be converging on a consensus for my proposal:
>>
>>     base(value, radix=2)
>>
>> So far no one has shot at it, and it has gathered +1's from Steven,
>> Alex, Brett, and Nick.
>
> +1 for me too, but I'd also like to deprecate hex() and oct() and
> slate them for removal in 3k.
>
> To expand, valid radix values would be 2..36 (ie, same as for int).
> It was discussed putting base() in some module.  Was there consensus
> about builtin vs a module?  I'd prefer a module, but builtin is ok
> with me.

I'd drop the default radix, or make it something common like 16...  
especially if hex and oct are to be py3k deprecated.

+1 for: base(value, radix)
+1 for: "%b" % (integer,)
+0 for binary literals: 0b01101

-bob



More information about the Python-Dev mailing list