[Python-Dev] str with base

Neal Norwitz nnorwitz at gmail.com
Thu Jan 19 08:37:16 CET 2006


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.

> To keep it simple, the proposal is for the value to be any int or long.
> With an underlying __base__ method call, it wouldn't be hard for someone
> to build it out to support other numeric types if the need arises.
>
> The output would have no prefixes.  As Alex pointed out, it is easier
> and more direct to add those after the fact if needed.

+1

> Care to pronounce on it?
>
>
> Raymond


More information about the Python-Dev mailing list