gh-131885: Updates docs to make max and min iterable param positional only#131868
gh-131885: Updates docs to make max and min iterable param positional only#131868AA-Turner merged 6 commits into
Conversation
|
Actually, I'm finding more examples of these cases such as map and range. If the above looks good I'll add more commits to include those too. |
Sorry, something went wrong.
skirpichev
left a comment
There was a problem hiding this comment.
Actually, I'm finding more examples of these cases such as map and range. If the above looks good I'll add more commits to include those too.
Previously similar change was reverted: #99476 See also #125945
While devguide suggests now using correct function signatures, I'm not sure we shold push this that way.
We definitely need an issue, e.g. to adjust all signatures on the builtin functions page. We should also consider if we could actually simplify function signatures to avoid '/' and/or '*' syntax. See https://discuss.python.org/t/81003
CC @AA-Turner
Sorry, something went wrong.
Thanks for these references!
Thank you for linking this read! I too would like to see simplifying these built-in function signatures, and have functions like As I understand it, doing so would be a one day door that would require additional thought and decisions, as if it went through and started to be used, it would no longer be backwards compatible. Until then, this seems like the next best step. It's what the Editorial board has agreed on, it brings consistency, and reverting these changes in the future if and when they are simplified would be easy. As it stands, without these changes:
|
Sorry, something went wrong.
Personally, I read this is as requirement and not a suggestion. Namely,
Here, the
So I think it's fine to accept those changes. The reversal of previous changes was mostly done because it was incorrect, albeit |
Sorry, something went wrong.
Probably, yes. But rather than mechanically accept "complex" signatures - we should revisit on case-by-case basis if we could simplify them. E.g. support
@picnixz, are you about #99476? Reversion was argued not by correctness: #98340 |
Sorry, something went wrong.
|
Ah no I see. Ok you were talking about another PR. My bad. Well, the EB decision is quite recent and the reversal was done before that decision so I think it doesn't apply here. |
Sorry, something went wrong.
For this reason, I'm not sure the tracking issue is helpful -- it will encourage people to create many PRs to 'fix' the issue, when it is not just a mechanical transformation at hand. |
Sorry, something went wrong.
This is the reason why I didn't add the "easy" label. But tracking is fine I think. I can add a warning note to say that it's not an easy one as the transformation is not just mechanical |
Sorry, something went wrong.
Someone could comment on issue to clarify it further. |
Sorry, something went wrong.
|
I've added a red caution box, hopefully it will be seen |
Sorry, something went wrong.
AA-Turner
left a comment
There was a problem hiding this comment.
We should avoid mixing C-style [,optional-arg] with the / etc markers.
I think we should also not conflate changes to the documentation, which support a wider range of syntax, with changes to function signatures in docstrings, which are interpreted by pydoc, help(), etc. See Raymond's Discourse post on improving support for signatures, and Serhiy's draft work on multi-signature support for inspect.
For now, please revert the changes to bltinmodule.c, and we can start with iterative improvements to the rST documentation.
A
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Sorry, something went wrong.
Co-authored-by: Evan Kohilas <ekohilas@users.noreply.github.com>
Ah sorry I'm clicking the rebase button via GitHub. Are there guidelines on why I should avoid force pushing in the cpython repo? |
Sorry, something went wrong.
|
Sure, they listed in the devguide: https://devguide.python.org/getting-started/pull-request-lifecycle/#id2 |
Sorry, something went wrong.
terryjreedy
left a comment
There was a problem hiding this comment.
Sorry, something went wrong.
|
@AA-Turner You requested removal of changes from the .c module, and this was done. Anything else? or dismiss change? |
Sorry, something went wrong.
dd079db
into
python:main
Aug 11, 2025
|
Thanks @ekohilas for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
…)`` (pythonGH-131868) (cherry picked from commit dd079db) Co-authored-by: Evan Kohilas <ekohilas@users.noreply.github.com>
…)`` (pythonGH-131868) (cherry picked from commit dd079db) Co-authored-by: Evan Kohilas <ekohilas@users.noreply.github.com>
* main: pythongh-137288: Update 3.14 magic numbers (pythonGH-137665) pythongh-135228: When @DataClass(slots=True) replaces a dataclass, make the original class collectible (take 2) (pythonGH-137047) pythongh-126008: Improve docstrings for Tkinter cget and configure methods (pythonGH-133303) pythongh-131885: Use positional-only markers for ``max()`` and ``min()`` (python#131868) pythonGH-137426: Remove code deprecation of `importlib.abc.ResourceLoader` (pythonGH-137567) pythongh-125897: Mark range function parameters as positional only (python#125945) pythongh-137400: Fix a crash when disabling profiling across all threads (pythongh-137471) pythongh-115766: Fix IPv4Interface.is_unspecified (pythonGH-137326) pythongh-128813: cleanup C-API docs for PyComplexObject (pythonGH-137579) pythongh-135953: Profile a module or script with sampling profiler (python#136777) Fix documentation of hash in PyHash_FuncDef (python#137595)
This PR updates the documentation of
maxandminto match their implementation like howsorted's implementation matches it's documentation.Sorted's function definition in the documentation is as follows:
sorted(iterable, /, *, key=None, reverse=False)When attempted to call with
iterableas a keyword argument, the following occurs:However, looking at the documentation for
max:max(iterable, *, key=None)And comparing to their implementation:
The same follows for
min📚 Documentation preview 📚: https://cpython-previews--131868.org.readthedocs.build/
*and/as needed #131885