Typing and Generics
typing.Iterable
A source whose elements can be traversed. It need not support indexing, length or repeated iteration. Deprecated typing alias; prefer collections.abc.Iterable in modern code (3.9+).
Formal Syntax & Structure
python syntaxpython
typing.Iterable[T]Return Value
type expression
Typing construct or runtime result as described; static typing rules are not runtime validation.
Working Example
Example Snippetpython
from typing import Iterable
def total(values: Iterable[int])->int: return sum(values)print(total(n for n in (1,2,3)))