Skip to content

Commit

Permalink
Make operator precedence explicit, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Jan 31, 2025
1 parent b84e059 commit 128679e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ reveal_type(C().declared_and_bound) # revealed: Unknown
```py
class C:
def __init__(self) -> None:
if 2 + 3 < 4:
# We use a "significantly complex" condition here (instead of just `False`)
# for a proper comparison with mypy and pyright, which distinguish between
# conditions that can be resolved from a simple pattern matching and those
# that need proper type inference.
if (2 + 3) < 4:
self.x: str = "a"

# TODO: Ideally, this would result in a `unresolved-attribute` error. But mypy and pyright
Expand Down

0 comments on commit 128679e

Please sign in to comment.