[Python-ideas] Make Python front end to the C math module
Steven D'Aprano
steve at pearwood.info
Sun Jun 19 11:02:52 EDT 2016
Currently the math module is written in C, not Python. This greatly
increases the barrier to contributions to math. I suggest that we treat
the existing math module as an accelerator module:
- rename math.so to _math.so;
(or whatever platform-specific name it uses)
- add math.py with something like the following content:
from _math import *
and we're done! That will make it easier for people to contribute pure
Python functions in the future. Currently all math functions, regardless
of how trivial or difficult, must be written in C. With this change,
they can be written in Python, and only written in C if necessary.
For the avoidance of doubt, there is NO requirement for pure-Python
implementations of the existing math functions, or even future ones.
Future functions can go straight into the C implementation is desired.
This is to allow future functions the opportunity to be written in
Python.
--
Steve
More information about the Python-ideas
mailing list