Skip to content

Instantly share code, notes, and snippets.

@carljm
Created March 25, 2026 20:27
Show Gist options
  • Select an option

  • Save carljm/252ff444d987ffdc24bfa79f13909615 to your computer and use it in GitHub Desktop.

Select an option

Save carljm/252ff444d987ffdc24bfa79f13909615 to your computer and use it in GitHub Desktop.
{"version": 1, "file_mapping": {"main.py": "main.py", "pyproject.toml": "pyproject.toml"}}
from typing import Callable
def identity[S, T](c: Callable[[S], T]) -> Callable[[S], T]:
return c
class A: ...
class B: ...
def _(c: Callable[[A], A] | Callable[[B], B]):
reveal_type(identity(c))
[project]
name = "sandbox"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = []
[tool.ty]
[tool.ty.rules]
undefined-reveal = "ignore"
[tool.pyright]
reportWildcardImportFromLibrary = false
reportSelfClsParameterName = false
reportUnusedExpression = false
# typeCheckingMode = "strict"
[tool.mypy]
color_output = true
pretty = true
check_untyped_defs = true
[tool.zuban]
pretty = true
check_untyped_defs = true
[tool.pyrefly]
[tool.pycroscope]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment