Python Tip #153 (of 365):
When you write type annotations, embrace duck typing: annotate with the most general type you can.
Don't require a list if any iterable will do. Don't require a dict if any mapping will do.
Most functions that "accept a list" actually accept any iterable.
Instead of:
def square_all(numbers: list[float]) -> list[float]: ...
Prefer:
from collections.βabc import Iterable
def square_all(numbers: Iterable[float]) -> list[float]: ...
π§΅ (1/2)