diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2022-03-24 02:15:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 02:15:06 (GMT) |
commit | 3354245daf89ca2c760c2c3e5b69a571f25073ed (patch) | |
tree | 6e9956b887e02dc2e8905c501c6660a687de61d3 /Doc/library/typing.rst | |
parent | 366c54633e7d6a4ce94c3f0f80c2abf82a869e15 (diff) | |
download | cpython-3354245daf89ca2c760c2c3e5b69a571f25073ed.zip cpython-3354245daf89ca2c760c2c3e5b69a571f25073ed.tar.gz cpython-3354245daf89ca2c760c2c3e5b69a571f25073ed.tar.bz2 |
bpo-46480: rephrase typing.assert_type docs (GH-32069)
The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.
The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
Diffstat (limited to 'Doc/library/typing.rst')
-rw-r--r-- | Doc/library/typing.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 57979cb..4d833dc 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2150,7 +2150,7 @@ Functions and decorators .. function:: assert_type(val, typ, /) - Assert (to the type checker) that *val* has an inferred type of *typ*. + Ask a static type checker to confirm that *val* has an inferred type of *typ*. When the type checker encounters a call to ``assert_type()``, it emits an error if the value is not of the specified type:: |