Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 9, 2026 19:51
Show Gist options
  • Select an option

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

Select an option

Save mypy-play/900109d4edbe049f7c3a36abf7ea98fb to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Self, reveal_type
class NodeA:
def __init__(self: Self) -> None:
reveal_type(self) # Self`0
self.myself: Self = self # ✅️
class NodeB:
def __init__(self) -> None:
reveal_type(self) # __main__.NodeB
self.myself: Self = self # ❌️
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment