Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created May 24, 2024 22:33
Show Gist options
  • Save mypy-play/7f8a9393d11b1b61c88b72e3fbf477c1 to your computer and use it in GitHub Desktop.
Save mypy-play/7f8a9393d11b1b61c88b72e3fbf477c1 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
t1 = ()
t2 = tuple()
reveal_type(t1) # tuple[()]
reveal_type(t2) # tuple[Any, ...]
foo = lambda: list(t1)
bar = lambda: list(t2)
qux = lambda: list(tuple())
reveal_type(foo) # () -> list[Any]
reveal_type(bar) # () -> list[Any]
reveal_type(qux) # () -> list[Any]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment