On 12 July 2018 at 23:41, Serhiy Storchaka email@example.com wrote:
12.07.18 16:15, Robert Vanden Eynde пише:
About the name, why not intmath ?
Because cmath. But if most core developers prefer intmath, I have no objections.
My initial reaction from just the subject title was "But we already have cmath, why would we need imath?", based on the fact that mathematicians write complex numbers as "X + Yi", rather than the "X + Yj" that Python borrowed from electrical engineering (where "i" already had a different meaning as the symbol for AC current).
Calling the proposed module "intmath" instead would be clearer to me (and I agree with the rationale that as the number of int-specific functions increases, separating them out from the more float-centric math module makes sense).
Beyond that, I think the analogy with the statistics module is a good one:
1. There are a number of integer-specific algorithms where naive implementations are going to be slower than they need to be, subtly incorrect in some cases, or both. With a standard library module, we can provide a robust test suite, and pointers towards higher performance alternatives for folks that need them. 2. For educational purposes, being able to introduce the use cases for a capability before delving into the explanation of how that capability works can be quite a powerful technique (the standard implementations can also provide a cross-check on the accuracy of student implementations).
And in the intmath case, there are likely to be more opportunities to delete private implementations from other standard library modules in favour of the public intmath functions.