Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created December 27, 2025 06:33
Show Gist options
  • Select an option

  • Save mypy-play/2e1728d4059bf595164ca3549e1a9824 to your computer and use it in GitHub Desktop.

Select an option

Save mypy-play/2e1728d4059bf595164ca3549e1a9824 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
class A:
import math
def __new__(cls) -> "A":
reveal_type(cls.math.pi) # N: Revealed type is "Any"
return cls()
def pos_or_named_self(self) -> None:
reveal_type(self.math.pi) # N: Revealed type is "builtins.float"
def pos_only_self(self, /) -> None:
reveal_type(self.math.pi) # N: Revealed type is "Any"
@classmethod
def clsmethod(cls) -> None:
reveal_type(cls.math.pi) # N: Revealed type is "builtins.float"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment