Skip to content

Commit 4ea7395

Browse files
Introduce "type names" section to the style guide (#1828)
Co-authored-by: Stan Ulbrych <stan@python.org> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 49331f5 commit 4ea7395

1 file changed

Lines changed: 50 additions & 22 deletions

File tree

documentation/style-guide.rst

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,35 @@ of these entities are not assigned any special markup, but the preferred
5858
spellings are given in :ref:`specific words` to aid authors in maintaining the
5959
consistency of presentation in the Python documentation.
6060

61+
62+
Use simple language
63+
===================
64+
65+
Avoid esoteric phrasing where possible. Our audience is world-wide and may not
66+
be native English speakers.
67+
68+
Don't use Latin abbreviations like "e.g." or "i.e." where English words will do,
69+
such as "for example" or "that is."
70+
71+
72+
Charged terminology to avoid
73+
============================
74+
75+
Avoid terminology that may be considered insensitive or exclusionary.
76+
77+
.. list-table::
78+
:header-rows: 1
79+
80+
* - Avoid
81+
- Instead
82+
* - whitelist
83+
- allowlist
84+
* - blacklist
85+
- blocklist, denylist
86+
* - master/slave
87+
- main, parent/child, server/client, primary/secondary
88+
89+
6190
.. _specific words:
6291

6392
Specific words
@@ -116,33 +145,30 @@ Unix
116145
1970s.
117146

118147

119-
Use simple language
120-
===================
148+
Type names
149+
==========
121150

122-
Avoid esoteric phrasing where possible. Our audience is world-wide and may not
123-
be native English speakers.
124-
125-
Don't use Latin abbreviations like "e.g." or "i.e." where English words will do,
126-
such as "for example" or "that is."
127-
128-
129-
Charged terminology to avoid
130-
============================
151+
When writing the names of types in prose, indicate that the name is a type by
152+
writing the name of the type exactly as it appears in source, styled as a class
153+
reference or an unlinked class. For example, refer to dict as ``:class:`dict`‌``
154+
or ``:class:`!dict`‌``.
131155

132-
Avoid terminology that may be considered insensitive or exclusionary.
156+
Links should be used according to the :ref:`guidance on links <style-guide-links>`.
133157

134-
.. list-table::
135-
:header-rows: 1
158+
Some type names are commonly understood ideas or nouns outside of Python.
159+
For example, "tuples" are a general programming concept, as distinct from the
160+
``tuple`` type. When referring to general ideas, do not style the relevant word
161+
as a type.
136162

137-
* - Avoid
138-
- Instead
139-
* - whitelist
140-
- allowlist
141-
* - blacklist
142-
- blocklist, denylist
143-
* - master/slave
144-
- main, parent/child, server/client, primary/secondary
163+
Many types have descriptive names which may or may not exactly match their type
164+
name. For example, "context variables" describes ``contextvars.ContextVar``,
165+
and both "dict" and "dictonary" are used to describe ``dict``. Once it is clear
166+
that the text refers to a specific type, use the naming which suits the context:
167+
in the case of ``dict``, any of "dict", "dictionary", or "``:class:`dict```" may
168+
be best.
145169

170+
Descriptive names should be written as common nouns, meaning they are lowercase
171+
when not at the start of a sentence or phrase.
146172

147173
.. index:: diataxis
148174
.. _diataxis:
@@ -190,6 +216,8 @@ Please consult the `Diátaxis <https://diataxis.fr/>`__ guide for more
190216
detail.
191217

192218

219+
.. _style-guide-links:
220+
193221
Links
194222
=====
195223

0 commit comments

Comments
 (0)