-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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 '/' in signatures #65513
Comments
Please look at the output of help(object.__ge__).
|
I don't know about the other bits, but that trailing '/' is how Argument Clinic (which makes full featured inspection available to built-in functions) notes that the parameters are positional only, and cannot be passed by keyword. See PEP-436. |
I fixed that typo on Friday (actually prompted by your previous issue about len's bad signature).
|
Can someone close this? I think it's fixed. |
The original bug (junk in various doc strings) has been fixed, but I think the positional argument "/" syntax still needs docs. It's a little tricky because "/" is not actually valid syntax; it's just for documentation signatures. |
where's the best place for that documentation to live? |
Apologies for the delay in answering, Emily. And, unfortunately, I don't have a good answer. If you would like to write a patch, I would suggest just sticking the documentation wherever you think is best and make sure there is a link to it from the Symbols index page. Whoever commits your patch will either agree with your placement or have a better idea of where to put it, and will either move it themselves or work with you to move it. Here are a few possible places it could go, off the top of my head and without really looking:
|
I'd suggest adding a FAQ entry to the "Core Language" section at https://docs.python.org/3/faq/programming.html#core-language then we can link to it from the places (except pydoc docs) Zachary listed in msg223893. |
Can I work on this? |
Welcome, Noah! Feel free to work on this issue, but please note that there is no consensus on the best place to document / signatures, so you may need to move your changes between locations (e.g. from Doc/faq/programming.rst to Doc/gloassary.rst) before we merge your work. |
We now have a PEP for this; just noting this here since I don't see a cross reference between them. |
Noah, are you working on this? |
I don‘t have the time right now. Feel free to work on it! |
Ping for review. |
I went ahead and merged Lysandros's new FAQ entry (Thank you Lysandros!), as having some level of documentation for this notation is markedly better than the previous "none at all", and the PR added cross-references from the builtins and inspect module docs in addition to adding the FAQ itself. However, I'm not closing the issue yet as:
|
I agree with Nick, that pydoc should somehow be updated to mark positional-only parameters as such. I believe that the third approach proposed by Nick is the most sensible one, as it makes the life of new developers easier by explicitly listing all the positional-only parameters. I could open a new issue and work on a PR, if you all agree that that is the way to go. |
I think we can revisit this now that PEP-570 is accepted |
Hooray! Now that PEP-570 is implemented in 3.8: >>> def f(a, /, *, b): return 3
...
>>> f(0, b=2)
3
# other combinations raise and somewhat documented, ('/' in grammar of '8.6 Function definitions', though not explained, should its status become final and listing moved? |
IMO the only thing left is to make searching for |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: