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 647: TypeGuard #916

Closed
JelleZijlstra opened this issue May 11, 2021 · 7 comments
Closed

Support PEP 647: TypeGuard #916

JelleZijlstra opened this issue May 11, 2021 · 7 comments
Labels
cat: core core language and typing features enhancement

Comments

@JelleZijlstra
Copy link
Contributor

I'd like to start using https://www.python.org/dev/peps/pep-0647/ in typeshed. Do you have any plans in that direction already?

I can look into adding basic support to unblock typeshed, which would mean simply interpreting TypeGuard[...] as an alias for bool.

@rchen152
Copy link
Contributor

No plans yet, but as you said, it shouldn't be too difficult for us to just interpret TypeGuard as bool for now.

@rchen152
Copy link
Contributor

I should have some time to do this tomorrow afternoon.

@JelleZijlstra
Copy link
Contributor Author

Thanks!

rchen152 added a commit that referenced this issue May 13, 2021
For #916.

PiperOrigin-RevId: 373679585
@rchen152
Copy link
Contributor

I've implemented rewriting TypeGuard[X] to bool in stubs; I'll try to do a release tomorrow.

@rchen152
Copy link
Contributor

Ok, pytype 2021.05.14 is out. Please let me know if you run into any issues using TypeGuard in stubs.

@JelleZijlstra
Copy link
Contributor Author

Thanks again!

@rchen152 rchen152 added the cat: core core language and typing features label May 18, 2021
@rchen152
Copy link
Contributor

We've got a basic implementation of TypeGuard done. It'll be in the next release, hopefully tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat: core core language and typing features enhancement
Projects
None yet
Development

No branches or pull requests

2 participants