Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 14, 2026 12:44
Show Gist options
  • Select an option

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

Select an option

Save mypy-play/30ccdeee19d6bcf9d54250b2cd0a6df7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Iterator, Literal
def fib[T: Literal[10,11]](n: T) -> Iterator[int]:
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
fib[10](10)
fib(11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment