[Python-ideas] str(<int>, base=<int>) as complement to int(<str>, base=<int>)
rrr at ronadam.com
Thu Nov 1 16:58:32 CET 2007
Christian Heimes wrote:
>> Or should it be a function in the math or string module?
> Why do you want to hide the function somewhere instead of putting the
> functionality in an obvious place. In Python 3000 the str() builtin has
> two optional arguments:
> str(s, [encoding, [errors]])
> Isn't base 2 or base 16 just another kind of encoding? IMHO the
> intergers 2, 8 or 16 can be treated as a form of encoding just as
> "ascii" or "latin-1".
See Guido's reply about it not being a str() constructor.
Sense int types don't have non-special methods it can't be an int method.
I don't think it's needed often enough to justify making it a global
That leaves putting it in either the string or math module.
I don't think of it as hiding. I think of it a grouping which makes it
easier to find rather than harder to find.
More information about the Python-ideas