[Python-Dev] str with base
Tim Peters
tim.peters at gmail.com
Fri Jan 20 01:07:19 CET 2006
[Nick Coghlan]
> ...
> I quite like the suggestion of using 'math.base' rather than a builtin, but
> there are still issues to be figured out there:
> - the math module is currently a thin wrapper around C's "math.h". Do we
> really want to change that by adding more methods?
That's not an issue. Some math functions go beyond C's (like
2-argument log(), and all flavors of log() returning sensible results
for inputs larger than the largest C double), and some functions
aren't part of C at all (like math.radians()).
A stronger reason to keep it out of `math` is that all functions there
operate on, and return, floats: it's a bizarre place to put an
integer->string function.
> - is 'base' the right name?
> - should we allow a "digits" argument, or just the radix argument?
Add to_base(self, radix=16) as a new numeric method. End of problem ;-)
More information about the Python-Dev
mailing list