-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-45619: documentation of execution model: clarify and update binding summary #29232
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
Conversation
Doc/reference/executionmodel.rst
Outdated
* class and function definitions (these bind the class or function name in the | ||
defining block), | ||
* and targets that are identifiers: | ||
+ if occurring in an assignment, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think assignment expressions should be a separate bullet (as you said you considered in the PR description). Also, I think it should go above here, because the LHS of a walrus is not a target -- it's a plain name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know what is the exact definition of a target (even if I can guess from context), and I can't easily find such a definition in the documentation. If it is defined somewhere formally, I'd argue to link to it. Otherwise, seems a good place to define it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could link here for target: https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target
7bf3fde
to
e650917
Compare
Also, it will probably need the skip-news label. But I can't add it myself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make these tiny fixes and then consider it good enough to merge. I’ll wait a bit for others to pipe up though.
Can you add the link to ‘target’? |
Can you fix the test errors? (You can run the doc build process locally to experiment until it passes. IIRC there’s a README in the Doc directory.) |
17deea1
to
a65420d
Compare
I don't see how to add a link to target. For two reasons. First I need a plural and links seems to only work for singular. Secondly, the examples I find are keywords, but target is not a keyword. And since it seems that it is a Python specific role, I can't directly find a detailed description in sphinx documentation. I did try to run. However,
The error message is really sparse, making it hard to actually debug. I'll however check the git error message hoping it will help understanding. |
a65420d
to
a4d3902
Compare
Seems the docs pipeline is wedged due to a new release of docutils(?). Let’s forget about the link. P.S. There is no need to squash commits, we do that at the end when we merge. |
If you merge/rebase the latest main, the doc build should be fixed. I'd like to make sure this passes before merging. Thanks! |
Doc/reference/executionmodel.rst
Outdated
+ in a capture pattern in structural pattern matching | ||
* :keyword:`import` statements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you need a blank line after the interior bullet list? That might render ugly, but we can't keep the warning on the next line. But I'm not a ReST expert. :-(
a4d3902
to
4d0ca93
Compare
I confirm that, after rebasing, I can now compile it. I'm new to Sphinx, but I'm confident I can now correct it quickly, thanks to clear error message |
4d0ca93
to
fe1c060
Compare
fd79da4
to
fe1c060
Compare
#29183 has this markup for a cross-doc link.
It links the library/math truncate entry to the reference/data_model object.trunc entry. This must depend on some global uniqueness. |
That format is: .. reference with custom text
:role:`free text <reference>`
.. short version, the text of the link is determined by the target:
:role:`reference`
I hadn’t noticed the |
Found the reference: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-productionlist So it should be: :token:`target` or :token:`targets <target>` for a plural |
I just noticed I pushed two commits by accident. The first has nothing to do in this PR, trunc is already considered in another PR. Is it okay if I remove it and force push to keep only relevant commit ? Or do you want me to push a commit reverting the first commit ? |
For this situation a force-push is fine. |
This does two changes that are quite related. 0. it add that variable binding can occur in pattern matching, an update of 3.10 which seems to have been omitted from the list of bindings 1. Given how long the sentence alrady was, with even subcases in the middle of the sentence, the commit breaks the sentence into an actual list.
fe1c060
to
ac31c78
Compare
Done. I removed the commit that should not have been here.
I suspect this is not relevant anymore for this PR. |
I am not so sure 🙂 that sub-discussion was prompted by this comment that’s relevant to this PR:
I replied to Terry’s question about linking to grammar tokens (re-discovering the markup that you had already used in fact), and can also answer your question: :ref:`assignment`
.. or to control link text
:ref:`targets <assignment>` should create a link to the heading you want. This line defines the target: https://github.com/python/cpython/blob/3.10/Doc/reference/simple_stmts.rst#L69 About index: they don’t reuse human-defined targets but create their own, such as https://docs.python.org/3.10/reference/simple_stmts.html#index-4 (example link reached from |
Hopefully @merwok and @terryjreedy can finish reviewing this PR? I need to focus elsewhere. |
I just updated "targets" to be a link to the entry "assignment". I hope this ensure that the PR can now be approved. I'm not really sure whether "assignment" section or "token" literal is better; personally I'm totally fine with both. I used the latter because I thought it was what was asked, I beg your pardon for misunderstanding. I edited the PR first message to update it with what is now actually in the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a sufficient improvement over what we have to merge the PR. However, I think this is an example of why our "reference" manual is too imprecise to be considered a language specification. Alas, it would take a committee of 10 people 10 years to come up with an adequate specification, and we just don't have those resources. So this will have to do.
Thanks @Arthur-Milchior for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
@gvanrossum: Please replace |
…ng summary (pythonGH-29232) This does two changes that are quite related. 0. it add that variable binding can occur in pattern matching, an update of 3.10 which seems to have been omitted from the list of bindings 1. Given how long the sentence already was, with even subcases in the middle of the sentence, the commit breaks the sentence into an actual list. (cherry picked from commit cd876c8) Co-authored-by: Arthur Milchior <[email protected]>
GH-29787 is a backport of this pull request to the 3.10 branch. |
…ng summary (GH-29232) This does two changes that are quite related. 0. it add that variable binding can occur in pattern matching, an update of 3.10 which seems to have been omitted from the list of bindings 1. Given how long the sentence already was, with even subcases in the middle of the sentence, the commit breaks the sentence into an actual list. (cherry picked from commit cd876c8) Co-authored-by: Arthur Milchior <[email protected]>
…ng summary (python#29232) This does two changes that are quite related. 0. it add that variable binding can occur in pattern matching, an update of 3.10 which seems to have been omitted from the list of bindings 1. Given how long the sentence already was, with even subcases in the middle of the sentence, the commit breaks the sentence into an actual list.
bpo-45619: updating and improving the list of bindings
This does three changes that are quite related.
a. assignment-expression can also bind a value. This should have been updated in 3.8.
b. variable binding can occur in pattern matching, an update of 3.10
This PR would be relevant in 3.8 and 3.9, except obviously for the pattern matching part. However, I understand that is not critical and can't be easily cherry-picked, so I assume it won't be backported.
https://bugs.python.org/issue45619