11PEP: 791
2- Title: intmath --- module for integer-specific mathematics functions
2+ Title: math.integer --- submodule for integer-specific mathematics functions
33Author: Sergey B Kirpichev <skirpichev@gmail.com>
44Sponsor: Victor Stinner <vstinner@python.org>
55Discussions-To: https://discuss.python.org/t/92548
@@ -15,9 +15,9 @@ Post-History: `12-Jul-2018 <https://mail.python.org/archives/list/python-ideas@p
1515Abstract
1616========
1717
18- This PEP proposes a new module for number-theoretical, combinatorial and other
19- functions defined for integer arguments, like :external+py3.14:func: ` math.gcd `
20- or :external+py3.14:func: `math.isqrt `.
18+ This PEP proposes a new submodule for number-theoretical, combinatorial and
19+ other functions defined for integer arguments, like
20+ :external+py3.14:func: ` math.gcd ` or :external+py3.14:func: `math.isqrt `.
2121
2222
2323Motivation
@@ -34,10 +34,10 @@ explicitly noted otherwise, all return values are floats." This is no longer
3434true: *None * of the functions listed in the `Number-theoretic functions
3535<https://docs.python.org/3.14/library/math.html#number-theoretic-functions> `_
3636subsection of the documentation return a float, but the documentation doesn't
37- say so. In the documentation for the proposed ``intmath `` module the sentence
37+ say so. In the documentation for the proposed ``math.integer `` submodule the sentence
3838"All return values are integers" would be accurate. In a similar way we can
3939simplify the description of the accepted arguments for functions in both the
40- new module and in :external+py3.14:mod: `math `.
40+ new submodule and in :external+py3.14:mod: `math `.
4141
4242Now it's a lot harder to satisfy people's expectations about the module
4343content. For example, should they expect that ``math.factorial(100) `` will
@@ -129,8 +129,7 @@ Specification
129129=============
130130
131131The PEP proposes moving the following integer-related functions to a new
132- module, called ``intmath `` (see `Open Issues `_ for alternatives for
133- it's name):
132+ submodule, called ``math.integer ``:
134133
135134* :external+py3.14:func: `~math.comb `
136135* :external+py3.14:func: `~math.factorial `
@@ -147,7 +146,8 @@ Module functions will accept integers and objects that implement the
147146object to an integer number. Suitable functions must be computed exactly,
148147given sufficient time and memory.
149148
150- The :pypi: `intmath ` package will provide new module for older Python versions.
149+ The :pypi: `intmath ` package will provide new submodule content for older Python
150+ versions.
151151
152152
153153Possible Extensions
@@ -157,7 +157,7 @@ New functions (like mentioned in `Motivation <Motivation_>`_ section) are not
157157part of this proposal.
158158
159159Though, we should mention that, unless we can just provide bindings to some
160- well supported mathematical library like the GMP, the module scope should be
160+ well supported mathematical library like the GMP, the submodule scope should be
161161limited. For example, no primality testing and factorization, as
162162production-quality implementatons will require a decent mathematical background
163163from contributors and belongs rather to specialized libraries.
@@ -176,7 +176,7 @@ As aliases in :external+py3.14:mod:`math` will be kept for an indefinite time
176176How to Teach This
177177=================
178178
179- The new module will be a place for functions, that 1) accept
179+ The new submodule will be a place for functions, that 1) accept
180180:external+py3.14:class: `int `-like arguments and also return integers, and 2)
181181are also in the field of arbitrary-precision integer arithmetic, i.e. have no
182182dependency on the platform floating-point format or behaviour and/or on the
@@ -207,18 +207,18 @@ is ultimately a different function: it is the floor of the square root. It
207207would be confusing to give it the same name (under a different module).
208208
209209
210- Open Issues
211- ===========
210+ Module name
211+ -----------
212212
213213`Polling showed <https://discuss.python.org/t/92548/67 >`_ ``intmath `` as most
214214popular candidate with ``imath `` as a second winner.
215215
216216Other proposed names include ``ntheory `` (like SymPy's submodule),
217217``integermath ``, ``zmath ``, ``dmath `` and ``imaths ``.
218218
219- As a variant, the new module can be added as a submodule of the
220- :external+py3.14:mod: `math `: `` integer `` (most preferred), `` discrete `` or
221- ``ntheory `` (author preference).
219+ But the SC prefers a submodule rather than a new top-level module. Most
220+ popular variants of the :external+py3.14:mod: `math `'s submodule are:
221+ ``integer ``, `` discrete `` or `` ntheory `` (author preference).
222222
223223
224224Acknowledgements
0 commit comments