Great article!! By the way, is it typo? def flatten_recursive(lst: List[Any]) -> Iterable[Any]: """Flatten a list using recursion.""" for item in lst: if isinstance(item, list): yield from flatten(item) # This line! I think it will be `yield from flatten_recursive(item)` else: yield item