Skip to content

Commit cf95330

Browse files
switch statements in logical AND (performance test)
1 parent c9dc133 commit cf95330

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypy/checkexpr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4010,9 +4010,7 @@ def lookup_definer(typ: Instance, attr_name: str) -> str | None:
40104010

40114011
variants_raw = [(op_name, left_op, left_type, right_expr)]
40124012
elif (
4013-
# Note: use `covers_at_runtime` instead of `is_subtype` (#19006)
4014-
covers_at_runtime(right_type, left_type)
4015-
and (
4013+
(
40164014
# Checking (A implies B) using the logically equivalent (not A or B), where
40174015
# A: left and right are both `Instance` objects
40184016
# B: right's __rop__ method is different from left's __op__ method
@@ -4025,6 +4023,8 @@ def lookup_definer(typ: Instance, attr_name: str) -> str | None:
40254023
)
40264024
)
40274025
)
4026+
# Note: use `covers_at_runtime` instead of `is_subtype` (#19006)
4027+
and covers_at_runtime(right_type, left_type)
40284028
):
40294029
# When we do "A() + B()" where B is a subclass of A, we'll actually try calling
40304030
# B's __radd__ method first, but ONLY if B explicitly defines or overrides the

0 commit comments

Comments
 (0)