[Python-ideas] Add a builtin method to 'int' for base/radix conversion

MRAB python at mrabarnett.plus.com
Fri Sep 11 21:51:55 CEST 2009


Nick Coghlan wrote:
> Yuvgoog Greenle wrote:
>> Does anybody have any more use cases, ideas or suggestions? I'm getting
>> the feeling this suggestion is +0 to most people and +1 for the rest.
>> I'm pretty new to these mailing lists so does that mean a yes or a no?
> 
> A generally lukewarm response means a maybe :)
> 
> A positive response on python-ideas is still a maybe until the idea has
> subsequently also run the gauntlet of python-dev with actual code to
> back it up.
> 
> In this case, the status quo is:
> 
> str -> int (arbitrary base up to 36) via int() constructor (base "0"
> meaning Python literal format).
> 
> int -> str via str() (for decimal output), hex(), oct(), bin() and
> string formatting
> 
> So the currently unsupported use cases are limited to outputting numbers
> in bases between 3 and 36 that are not 8, 10 or 16.
> 
> You're probably going to have a hard time convincing anyone that those
> additional use cases are worth putting much effort into supporting (and
> even then, they're probably better off as a 3rd party library that can
> add things like support for integers in bases up to 62).
> 
It's one of those ideas:

Q: Do you think it's a good idea?
A: Yes.
Q: Do you think you'd use it?
A: Probably not.

:-)



More information about the Python-ideas mailing list