-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Adds docs for TypeGuard type, #10591 #10758
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have a couple of wording suggestions.
Also, I'm not sure the "Casts" section is the right place for these docs. "More types" is the traditional place for advanced type system features. I'm curious to hear others' opinions.
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@JelleZijlstra thanks! I thought that "casts" is the closest to type guards. I can move it, no problem. |
Thank you for this! Fixed a couple small nits |
@JelleZijlstra @hauntsaninja so, should I move this to "Advanced types"? Or is "Casts" the proper place? 🙂 |
I'd probably put it in "More types" too, but don't feel strongly. |
Moved! 👍 |
@hauntsaninja @JelleZijlstra friendly ping 🙂 |
Thanks again! :-) |
I am writting an article about
TypeGuard
s and I've noticed thatmypy
does not document howTypeGuard
s work.So, here it is!
It has several examples from the PEP itself and several custom ones.
I have tried to cover all corner-cases that I am aware of, but possibly there are other details that I've missed.
I would appreciate your feedback! 👍
Closes #10591