Skip to content

Commit 8ab7ad6

Browse files
Glossary: Add "static type checker" (#111837)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 82e36db commit 8ab7ad6

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Doc/glossary.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,11 @@ Glossary
11381138
an :term:`expression` or one of several constructs with a keyword, such
11391139
as :keyword:`if`, :keyword:`while` or :keyword:`for`.
11401140

1141+
static type checker
1142+
An external tool that reads Python code and analyzes it, looking for
1143+
issues such as incorrect types. See also :term:`type hints <type hint>`
1144+
and the :mod:`typing` module.
1145+
11411146
strong reference
11421147
In Python's C API, a strong reference is a reference to an object
11431148
which is owned by the code holding the reference. The strong
@@ -1214,8 +1219,8 @@ Glossary
12141219
attribute, or a function parameter or return value.
12151220

12161221
Type hints are optional and are not enforced by Python but
1217-
they are useful to static type analysis tools, and aid IDEs with code
1218-
completion and refactoring.
1222+
they are useful to :term:`static type checkers <static type checker>`.
1223+
They can also aid IDEs with code completion and refactoring.
12191224

12201225
Type hints of global variables, class attributes, and functions,
12211226
but not local variables, can be accessed using

Doc/howto/pyporting.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ are:
3939
#. Once your dependencies are no longer blocking you, use continuous integration
4040
to make sure you stay compatible with Python 2 and 3 (tox_ can help test
4141
against multiple versions of Python; ``python -m pip install tox``)
42-
#. Consider using optional static type checking to make sure your type usage
42+
#. Consider using optional :term:`static type checking <static type checker>`
43+
to make sure your type usage
4344
works in both Python 2 and 3 (e.g. use mypy_ to check your typing under both
4445
Python 2 and Python 3; ``python -m pip install mypy``).
4546

@@ -395,7 +396,7 @@ comparisons occur, making the mistake much easier to track down.
395396
Consider using optional static type checking
396397
--------------------------------------------
397398

398-
Another way to help port your code is to use a static type checker like
399+
Another way to help port your code is to use a :term:`static type checker` like
399400
mypy_ or pytype_ on your code. These tools can be used to analyze your code as
400401
if it's being run under Python 2, then you can run the tool a second time as if
401402
your code is running under Python 3. By running a static type checker twice like

Doc/library/datetime.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ on efficient attribute extraction for output formatting and manipulation.
3838
Third-party library with expanded time zone and parsing support.
3939

4040
Package `DateType <https://pypi.org/project/datetype/>`_
41-
Third-party library that introduces distinct static types to e.g. allow static type checkers
41+
Third-party library that introduces distinct static types to e.g. allow
42+
:term:`static type checkers <static type checker>`
4243
to differentiate between naive and aware datetimes.
4344

4445
.. _datetime-naive-aware:

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
.. note::
1919

2020
The Python runtime does not enforce function and variable type annotations.
21-
They can be used by third party tools such as type checkers, IDEs, linters,
22-
etc.
21+
They can be used by third party tools such as :term:`type checkers <static type checker>`,
22+
IDEs, linters, etc.
2323

2424
--------------
2525

0 commit comments

Comments
 (0)