Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-46480: add typing.assert_type#30843
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
JelleZijlstra commented Jan 24, 2022 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
JelleZijlstra commented Feb 2, 2022
@gvanrossum this one is also ready I believe. Feedback on this function in https://mail.python.org/archives/list/typing-sig@python.org/thread/MITFQ6Z45RRMXY3HNM66IC3XXS3TA3JN/#MITFQ6Z45RRMXY3HNM66IC3XXS3TA3JN was positive. (I also proposed assert_error() there, but dropped it because of negative feedback.) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
davidfstr commented Feb 2, 2022
It occurs to me that users of "assert_type()" may be surprised that it doesn't actually perform an assertion at runtime. Consider code like: I wonder if we might consider a word other than "assert", or maybe add the word "static" somewhere. Suggestions:
|
JelleZijlstra commented Feb 2, 2022
That's a reasonable concern, but it's probably better discussed on the typing-sig thread. I'm happy to change the PR if there's consensus for another name. I'll note though that |
davidfstr commented Feb 2, 2022
I'll plan to make a post tomorrow. |
JelleZijlstra commented Mar 10, 2022
@gvanrossum I think this should be ready to merge soon, since people on the typing-sig thread now seem on board with the |
AlexWaygood commented Mar 10, 2022
I'll try to take a look soon! |
AlexWaygood left a comment
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! Looks pretty good, just a few thoughts :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
JelleZijlstra commented Mar 12, 2022
Thanks for the review! |
AlexWaygood left a comment
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.
LGTM!
davidfstr left a comment
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.
Just 1 tiny nit:
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: David Foster <david@dafoster.net>
JelleZijlstra commented Mar 12, 2022
Planning to merge this tomorrow unless I get more feedback. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Another pending typing-sig proposal. This function serves as a static assertion to the type checker about the type of a value.
https://bugs.python.org/issue46480