Typing and Generics

typing.MutableSequence

An ordered collection that permits element assignment, insertion and removal. Use when an API must change the caller’s collection. Deprecated typing alias; prefer collections.abc.MutableSequence in modern code (3.9+).

Formal Syntax & Structure

python syntaxpython
typing.MutableSequence[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 MutableSequence
def add(values:MutableSequence[int])->None: values.append(4)data=[1,2]add(data)print(data)
Python Reference