-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
PLR1714
suggests rewriting code like:
if cmd.kind == CommandKind.X or cmd.kind == CommandKind.Z: ...
into
if cmd.kind in {CommandKind.X, CommandKind.Z}: ...
While it can be considered to legitimately improve readability, mypy
currently does not understand that cmd
is an instance of X
or Z
in the if
-block, whereas mypy
is able to understand it in the original code with or
.
@EarlMilktea suggests that we disable PLR1714 while it is incompatible with mypy
.
A caveat is that we won't benefit from such suggestions in case where we don't need mypy
's type narrowing, but I guess most of the time we are in a context where we need such narrowing, so it makes sense to disable the rule entirely.
EarlMilktea
Metadata
Metadata
Assignees
Labels
No labels