-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Introduce "type names" section to the style guide #1828
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
8935bce
1328257
3c5e2c7
e0faa0c
81deaa3
86a969f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,27 @@ Unix | |
| 1970s. | ||
|
|
||
|
|
||
| Type names | ||
| ========== | ||
|
|
||
| When writing the names of types in prose, write the name of the type | ||
| exactly as it appears in source, styled as a class reference or an unlinked | ||
| class. For example, refer to dict as ``:class:`dict``` or ``:class:`!dict```. | ||
|
|
||
| Links should be used according to the :ref:`guidance on links <links>`. | ||
|
|
||
| Some type names are commonly understood ideas or nouns outside of Python. | ||
| For example, "tuples" are a general programming concept, as distinct from the | ||
| ``tuple`` type. When referring to general ideas, do not style the relevant word | ||
| as a type. | ||
|
|
||
| Many types have descriptive names which do not exactly match their type | ||
| name. For example, "context variables" describes ``contextvars.ContextVar``, | ||
| and "partial function" may be used to describe an application of | ||
| ``functools.partial``. Use these names only when they serve to clarify the text | ||
| better than the type name itself would, and put them in lowercase. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest moving this entry after the simple language one, and perhaps also after the charged terminology one as well.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the "Specific words" section above it also move? I thought it made sense to put these together, and I still do. What would you say to moving both of these? I could do it here (pragmatic and easy, but my least favorite way), do a precursor PR to move "Specific words" down, or do a follow-up PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving "Specific words" sounds okay to me, no preference whether in this PR or another.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll do it here. I'm used to smaller projects with relatively much more review bandwidth per PR. I'm adjusting a bit for cpython and related projects. 🙂
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3c5e2c7 pushes them down, and as "proof" of my work making no other changes, the git diff selects the text which I did not cut-and-paste. I did introduce one extra newline, which seemed like it was missing for a section-break.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In line with my comment on the issue, could we add:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with this proposed text, but feel that it has a degree of overlap with the last paragraph. I'm going to try to integrate the two but intend to append this if I can't figure out a good combination.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The style guide as a whole could use a PEP-8 style note:
Specifically for class names in long discussion, perhaps this could mirror the guidance on links. The first occurrence should use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made an edit to weave these suggestions into the text, which required a little tuning of the first paragraph in addition to a larger change to the last. The part which is most different from Ned's suggestion is this:
I mean for that to carry the message about "the author will need to exercise judgement" as well as the idea that, like links, you should first clarify the exact type and then exercise more freedom in how you write. I'm very concerned with brevity for these docs, so I was trying to pack the ideas in very tightly, in the smallest reasonable number of words. |
||
|
|
||
|
|
||
| Use simple language | ||
| =================== | ||
|
|
||
|
|
||
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.
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.
Shouldn't that link to the section title? I feel certain that this worked for me.
I just added an explicit anchor, on the assumption that I got confused and forgot how sphinx handles section-names.
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 have a
:ref:, not a regular link`guidance on links `_(I don't remember if we still need the#) is what you're thinking aboutI'm +1 for an explicit reference however, I think it's far more future proof. But can we rename it to something a little more useful, like
links-style-guide.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.
Ah, so that we can use it from outside of the style-guide! Yes, I like that, but mildly prefer
style-guide-links(namespace first).I've added a co-authored commit. 🙂