Created
July 1, 2025 23:52
-
-
Save mypy-play/a7bcaf5164231390c6036f3818a63e55 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
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
from typing import Never, Self, overload | |
from warnings import deprecated | |
class MyClass: | |
def __init__(self: Self, x: int): | |
self.x = x | |
@overload | |
def __eq__(self, other: Self) -> bool: ... | |
@overload | |
@deprecated('foo') | |
def __eq__(self, other: object) -> bool: ... | |
def __eq__(self, other: object) -> bool: ... | |
reveal_type(MyClass(5) == 5) # ❌ I want mypy to give an error here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment