Skip to content
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

Document when to use positional-only markers #1020

Closed
hauntsaninja opened this issue Jan 1, 2023 · 5 comments
Closed

Document when to use positional-only markers #1020

hauntsaninja opened this issue Jan 1, 2023 · 5 comments
Labels
enhancement guide-new content Additions; New content or section needed needs: decision Needs consensus decision from core devs

Comments

@hauntsaninja
Copy link
Contributor

hauntsaninja commented Jan 1, 2023

This was recently the source of confusion that led to a sequence of PRs and reverts that caused a documentation regression, e.g. see python/cpython#100546 python/cpython#98340 python/cpython#91485 and some of the related PRs.

python/cpython#100444 (comment) is a reasonable summary of the current policy.

(Acknowledging there are somewhat related larger discussions, like how to document default values, when to use [] for optional parameters, whether to include types in documentation, but we can document the status quo before we figure those out. If we come up with some really nice solution for types in documentation, that could be a good place for positional-only information to live)

@CAM-Gerlach
Copy link
Member

@ezio-melotti @erlend-aasland you'll likely be interested in this as well...

Great point. As far as has been presented, the status quo is that there apparently is no clear policy, guidance or consensus on when to use the standard positional-only markers vs. more esoteric/contrived syntax, just individual dev's opinions, as is presented in that comment—and at least in the issues/PRs listed, I couldn't really find any others actively advocating for the same particular position.

As such, before enshrining any particular opinion as concrete written guidance in the devguide, IMO it would be a lot more beneficial to have a public discussion on this issue first (specifically, use of / vs. [ in signatures, and perhaps also including default values if we define the topic more broadly to be having function signature syntax follow the standard, expected Python convention to the extent practical), on Discourse and perhaps also at the monthly docs community (and editorial board) meeting, and document the resulting consensus.

FWIW, in the interests of full disclosure, my current viewpoint is that while it may be worth considering special-casing functions.rst for now for the reasons mentioned, and I do agree that improvements should be considered and made holistically and targeting toward the more complex functions where they are of the most benefit first, in general clarity, consistency, precision and lack of any ambiguity are critical attributes of API reference documentation. I do think they should be made as accessible as is practical to beginners, but I believe that can be done by other means* that don't significantly compromise the overriding goal of reference documentation: to describe, and to do that clearly, accurately and comprehensively.

* IMO, instead of special-casing functions.rst (or other areas), it should be possible to use a Sphinx extension to link the / and * in function signatures to a glossary entry or other basic, accessible explanation of what it means to mitigate the concern about confusing users without sacrificing clarity, precision and consistency in the Reference.

@willingc
Copy link
Collaborator

It looks as if this has been added to cpython docs. Closing here since it is out of scope for the devguide.

@AlexWaygood
Copy link
Member

@willingc are you sure this has been addressed in CPython? I think deciding on a general policy here, and adding it to the devguide, would be really useful. python/cpython#91485 didn't decide on a general policy here; somebody just happened to mention this issue in a comment as part of that PR thread :)

@AlexWaygood AlexWaygood reopened this Oct 11, 2023
@AlexWaygood AlexWaygood added needs: decision Needs consensus decision from core devs guide-new content Additions; New content or section needed and removed question labels Oct 11, 2023
@merwok
Copy link
Member

merwok commented Jul 19, 2024

FTR this was discussed again by the docs editorial board.

@AlexWaygood
Copy link
Member

Fixed in #1344 by @nedbat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement guide-new content Additions; New content or section needed needs: decision Needs consensus decision from core devs
Projects
None yet
Development

No branches or pull requests

5 participants