You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.11 will add the new typing.assert_type function, which is used for validating that two types are equivalent while static type checking. Switching from the type-comments, currently used for validating the revealed type, to typing.assert_type has a number advantages:
It finally allows to get rid of the old type-comments, which add a lot of visual clutter.
It makes it much easier to use features like type-aliases.
typing.assert_type is agnostic w.r.t. the particular type checkers, so this means we could in principle easily run the tests with other type checkers besides mypy.
Note that a backport is already available in typing-extensions and fully supported as of the latest mypy release (0.950).
Uh oh!
There was an error while loading. Please reload this page.
Proposed new feature or change:
Python 3.11 will add the new
typing.assert_type
function, which is used for validating that two types are equivalent while static type checking. Switching from the type-comments, currently used for validating the revealed type, totyping.assert_type
has a number advantages:typing.assert_type
is agnostic w.r.t. the particular type checkers, so this means we could in principle easily run the tests with other type checkers besides mypy.Note that a backport is already available in typing-extensions and fully supported as of the latest mypy release (0.950).
Examples
The text was updated successfully, but these errors were encountered: