google / pytype

A static type analyzer for Python code

Home Page:https://google.github.io/pytype

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support PEP 742 (TypeIs)

JelleZijlstra opened this issue · comments

Please add support for the TypeIs special form from PEP 742. Pytype support would help enable us to use the new feature in typeshed.

I am willing to work on this myself, but I might need some help getting the tests to run; when I last tried to build pytype locally, CMake didn't work.

I'll work on this.

Thanks! I already implemented it in both mypy and pyanalyze and it was pretty easy to do, essentially combining the mechanics of TypeGuard with the narrowing semantics of isinstance(). My mypy PR has a set of test cases that may be useful: python/mypy#16898