Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created September 2, 2026 03:16
Show Gist options
  • Select an option

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

Select an option

Save mypy-play/e911f6051028225c0fadd5434d87ff18 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Any
def do_something_awesome(thing: list[str | dict[Any, Any]]):
...
only_list_str: list[str] = ["foo", "bar"]
list_mixed: list[str, dict[Any, Any]] = ["foo", {"bar": "baz"}]
do_something_awesome(["foo", "bar"])
do_something_awesome(["foo"]+["bar"])
do_something_awesome(only_list_str)
do_something_awesome(list_mixed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment