Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
documentation for TypeIs#17821
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
documentation for TypeIs#17821
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Hnasar 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.
nice!
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.
for more information, seehttps://pre-commit.ci
for more information, seehttps://pre-commit.ci
JukkaL 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 for the PR! Overall looks great, just a few comments. It would be good to have this included in the mypy 1.12 release.
docs/source/type_narrowing.rst Outdated
| TypeIs | ||
| ------ | ||
| Mypy supports TypeIs (:pep:`754`). |
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.
The PEP number is 742.
| While both TypeIs and TypeGuard allow you to define custom type narrowing | ||
| functions, they differ in important ways: |
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.
The paragraph above is a duplicate.
docs/source/type_narrowing.rst Outdated
| defprocess(x: Any) ->None: | ||
| if is_instance_of(x,int): | ||
| reveal_type(x)# Revealed type is 'int' or any int subclass |
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.
Nit: The revealed type is just 'int', not any subclass.
JukkaL 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!
Fixes#17156.As requested in the issue, added documentation for the desired behaviourof TypeIs.
Fixes#17156
As requested in the issue, added documentation for the desired behaviour of TypeIs.