Re: [Python-ideas] str(<int>, base=<int>) as complement to int(<str>, base=<int>)
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".
Christian
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 builtin function. 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. Cheers, Ron
Ron Adam wrote:
That leaves putting it in either the string or math module.
I don't think it belongs in the math module, because that's supposed to correspond 1-1 with what's in the C math library. -- Greg
participants (2)
-
Greg Ewing
-
Ron Adam