Typing and Generics
typing.Sequence
An ordered, indexable collection with length. It is a read-oriented interface, not a guarantee of immutable storage. Deprecated typing alias; prefer collections.abc.Sequence in modern code (3.9+).
Formal Syntax & Structure
python syntaxpython
typing.Sequence[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 Sequence
def ends(values:Sequence[int])->tuple[int,int]: return values[0],values[-1]print(ends((2,4,6)))