Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save mypy-play/93bea1b2fbda6206d83d7b4e9fb7c5e9 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 "types.ModuleType"
return cls()
def pos_or_named_self(self) -> None:
reveal_type(self.math.pi) # N: Revealed type is "types.ModuleType"
def pos_only_self(self, /) -> None:
reveal_type(self.math.pi) # N: Revealed type is "types.ModuleType"
@classmethod
def clsmethod(cls) -> None:
reveal_type(cls.math.pi) # N: Revealed type is "types.ModuleType"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment