-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
PEP 791: address PEP review comments #4430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
skirpichev
wants to merge
15
commits into
python:main
Choose a base branch
from
skirpichev:pep791-address-comments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d72681f
PEP 791: address PEP review comments
skirpichev 5d3c129
add Rationale section
skirpichev 8cdce7a
expand Motivation
skirpichev 58a6938
Apply suggestions from code review
skirpichev 64e2db3
address review: -gcd()
skirpichev 919f797
address review: -02-Jun-2019 in metadata
skirpichev 656d55a
address review: remove sentences
skirpichev dfee009
mention gmpy2
skirpichev 0ab6557
address review: more submodule/module variants
skirpichev a47852e
expand Rationale
skirpichev 94ccb9f
rename module, move "Module name" section
skirpichev ae03c4b
Disband "Open Issues"
skirpichev 1af8e0d
Merge branch 'master' into pep791-address-comments
skirpichev 97d412e
Merge branch 'master' into pep791-address-comments
skirpichev cd179de
Mention intmath package
skirpichev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,10 @@ subsection of the documentation return a float, but the | |
documentation doesn't say so. In the documentation for the proposed ``imath`` module the sentence "All | ||
return values are integers." would be accurate. In a similar way we | ||
can simplify the description of the accepted arguments for functions in both the | ||
:external+py3.14:mod:`math` and the new module. | ||
new module and the :external+py3.14:mod:`math`. | ||
Which content, as in beginning, will be again related to work with "just | ||
numbers" --- that for most people with basic education means some model of real | ||
numbers). | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Apparently, the :external+py3.14:mod:`math` module can't serve as a catch-all place | ||
for mathematical functions since we also have the :external+py3.14:mod:`cmath` and | ||
|
@@ -52,6 +55,30 @@ Currently the :external+py3.14:mod:`math` module code in the CPython is around | |
comparable with the :external+py3.14:mod:`cmath` (1340LOC), which is *not* a | ||
simple wrapper to the ``libm``, as most functions in the | ||
:external+py3.14:mod:`math` module. | ||
And this situation tends to be worse. When the module split `was first | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
proposed | ||
<https://mail.python.org/archives/list/[email protected]/thread/YYJ5YJBJNCVXQWK5K3WSVNMPUSV56LOR/>`_, | ||
there were only two integer-related functions: | ||
:external+py3.14:func:`~math.factorial` and :external+py3.14:func:`~math.gcd`. | ||
Now there are six, :external+py3.14:func:`~math.factorial` doesn't accept | ||
:class:`float`'s anymore and :external+py3.14:func:`~math.gcd` changed it's | ||
signature. | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
Rationale | ||
========= | ||
|
||
Why not fix the :external+py3.14:mod:`math` module documentation instead? | ||
Sure, we can be much more vague in the module preamble (i.e. roughly say | ||
that "the :external+py3.14:mod:`math` module contains some mathematical | ||
functions") and we can accurately describe input/output for each function. | ||
|
||
But the major issue is that current module mix different, almost non-interlaced | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
application domains. Adding more documentation will just highlight this and | ||
make the issue worse for end users (more stuff to read/skip). And it will not | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fix issue with discoverability (to know in which module to find a function, and | ||
that it can be found at all, you need to look at all the functions in the | ||
module), nor with tab-completion. | ||
|
||
|
||
Specification | ||
|
@@ -131,6 +158,10 @@ interval math or numerical integration. | |
Other proposed names include ``ntheory`` (like SymPy's submodule), | ||
``integermath`` and ``imaths``. | ||
|
||
As a variant, new module can be added as a submodule of the | ||
:external+py3.14:mod:`math`. The main module itself will preserve "catch-all" | ||
skirpichev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
role for mathematics in the stdlib. | ||
|
||
|
||
Module scope and possible extensions | ||
------------------------------------ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.