[New-bugs-announce] [issue6783] Add a builtin method to 'int' for base/radix conversion

Yuv Gre report at bugs.python.org
Tue Aug 25 21:35:41 CEST 2009


New submission from Yuv Gre <ubershmekel at gmail.com>:

In javascript and java each number has a toString method which allows 
for easy string representation in different bases. If the function int(x[, base]) exists as a builtin, the inverse should at least be 
somewhere in the standard library. Personally I believe a "to_string" 
method would work but would defeat "There should be one way to do it". 
Perhaps a method called "radix" or "base_convert" which requires a base 
to convert parameter won't take the place of str(number).

Here are a few possible implementations:
http://code.activestate.com/recipes/222109/
http://code.activestate.com/recipes/111286/
http://pastebin.com/f54dd69d6

----------
components: Interpreter Core, Library (Lib)
messages: 91958
nosy: ubershmekel
severity: normal
status: open
title: Add a builtin method to 'int' for base/radix conversion
type: feature request
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6783>
_______________________________________


More information about the New-bugs-announce mailing list