On Mon, Jul 06, 2020 at 10:46:03AM -0700, Christopher Barker wrote:
1) The math module is written in C, and Guido at least (he was still BDFL then) rejected the idea of refactoring it to allow Python components (yes, that was proposed, and even started by, I think, Victor Stiner). Yes, you can write generic functions in C, but it's a lot more of a pain.
I think that it is long past time that we give up the idea that the math module is a thin wrapper around the system's C maths library. We should just add a math.py file that looks like this: from _math import *
2) The rest of the math module is currently all about floats already,
That's not really the case, and hasn't been for a while. Some functions manage to work very well with non-floats: py> math.factorial(100) 9332621544394415268169923885626670049071596826438162146859296389 5217599993229915608941463976156518286253697920827223758251185210 916864000000000000000000000000 # New in Python 3.8 I think? py> math.prod([1, 2, 3, Fraction(1, 5)]) Fraction(6, 5) Even if they return a float, or int, they still work with non-floats without losing accuracy: py> math.log10(10**5000) 5000.0 py> math.ceil(Fraction(1, 10**5000)) 1 even when the argument would overflow or underflow. -- Steven