KEMBAR78
Support `==`-based narrowing of Optional by tyralla · Pull Request #18163 · python/mypy · GitHub
Skip to content

Conversation

tyralla
Copy link
Collaborator

@tyralla tyralla commented Nov 18, 2024

Closes #18135

This change implements the third approach mentioned in #18135, which is stricter than similar narrowings, as clarified by the new/modified code comments. Personally, I prefer this more stringent way but could also switch this PR to approach two if there is consent that convenience is more important than type safety here.

Closes python#18135

This change implements the third approach mentioned in python#18135, which is stricter than similar narrowings, as clarified by the new/modified code comments. Personally, I prefer this more stringent way but could also switch this PR to approach two if there is a consent that convenience is more important than type safety here.
@tyralla tyralla added the topic-type-narrowing Conditional type narrowing / binder label Nov 18, 2024
@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Nice!

@hauntsaninja hauntsaninja merged commit e2a47e2 into python:master Nov 19, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-type-narrowing Conditional type narrowing / binder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

==-based narrowing of Optional

2 participants