Thanks everyone for the additional feedback. I just merged https://github.com/python/cpython/pull/30843, so we'll have typing.assert_type in Python 3.11! I'll also prepare a PR to add it to typing_extensions.

El lun, 7 mar 2022 a las 21:52, David Foster (<davidfstr@gmail.com>) escribió:
On 3/7/22 2:23 PM, Alex Waygood wrote:
> I agree with Jelle and Guido. The name isn't perfect, but I haven't seen
> any suggestions that seem better to me (and can't think of any myself).
> The function will be useful; I think it's time to move forward with this
> proposal.

Seems fine to me. (I'm one of the folks who was concerned with the
assert_type() name.)

In my own code, I'll probably opt to always use such an assert_type()
function in qualified form, as `typing.assert_type()` (by using `import
typing` rather than `from typing import assert_type`) since that will be
more likely to be treated as "something that has to do with static
typing" rather than a runtime assertion.

Best,
--
David Foster | Seattle, WA, USA
Contributor to TypedDict support for mypy