bpo-46480: rephrase typing.assert_type docs by hauntsaninja · Pull Request #32069 · python/cpython (original) (raw)

The goal here is to reduce potential confusion between
assert_type(val, typ) 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 previous phrasing of
"assert [something] to the type checker".

https://bugs.python.org/issue46480