Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PEP 742 (TypeIs) #1588

Closed
JelleZijlstra opened this issue Feb 19, 2024 · 2 comments
Closed

Support PEP 742 (TypeIs) #1588

JelleZijlstra opened this issue Feb 19, 2024 · 2 comments
Assignees
Labels

Comments

@JelleZijlstra
Copy link
Contributor

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.

@rchen152
Copy link
Contributor

I'll work on this.

@JelleZijlstra
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants