Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
JukkaL merged 9 commits intopython:masterfromchelseadz:documentTypeIs
Oct 9, 2024
Merged

Conversation

@chelseadz
Copy link

Fixes#17156

As requested in the issue, added documentation for the desired behaviour of TypeIs.

Copy link
Contributor

@HnasarHnasar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nice!

Copy link
Collaborator

@JukkaLJukkaL left a 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.

TypeIs
------

Mypy supports TypeIs (:pep:`754`).
Copy link
Collaborator

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:
Copy link
Collaborator

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.

defprocess(x: Any) ->None:
if is_instance_of(x,int):
reveal_type(x)# Revealed type is 'int' or any int subclass
Copy link
Collaborator

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.

Copy link
Collaborator

@JukkaLJukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks!

chelseadz reacted with thumbs up emoji
@JukkaLJukkaL merged commit9e24b56 intopython:masterOct 9, 2024
JukkaL pushed a commit that referenced this pull requestOct 9, 2024
Fixes#17156.As requested in the issue, added documentation for the desired behaviourof TypeIs.
@chelseadzchelseadz deleted the documentTypeIs branchOctober 10, 2024 01:16
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JukkaLJukkaLJukkaL approved these changes

+1 more reviewer

@HnasarHnasarHnasar approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Document TypeIs

3 participants

@chelseadz@Hnasar@JukkaL

[8]ページ先頭

©2009-2025 Movatter.jp