FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Return boolean literals directly from truthiness helpers by hauntsaninja · Pull Request #22255 · python/mypy · GitHub

Repository navigation

Return boolean literals directly from truthiness helpers - #22255

Merged
hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:simply8
Oct 21, 2026
Merged

hauntsaninja merged 1 commit into
python:masterfrom
hauntsaninja:simply8

Conversation

Copy link
Copy Markdown
Collaborator

Teach true_only and false_only to produce the single possible boolean literal directly, just as false_only already does for empty strings and integer zero.

Truthiness checks and boolean operators can then stop expanding bool into a union before asking these helpers to restrict it.

Authored by Codex

Teach true_only and false_only to produce the single possible boolean
literal directly, just as false_only already does for empty strings and
integer zero.

Truthiness checks and boolean operators can then stop expanding bool into
a union before asking these helpers to restrict it.

Authored by Codex

Copy link
Copy Markdown
Contributor

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

hauntsaninja marked this pull request as ready for review October 21, 2026 16:51
hauntsaninja merged commit bb42acf into python:master Oct 21, 2026
25 checks passed
hauntsaninja deleted the simply8 branch October 21, 2026 16:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL