Typing and Generics

typing.Final

Marks a variable or attribute as not to be rebound by well-typed code. It does not make a mutable object immutable. This qualifier is different from the @final decorator.

Formal Syntax & Structure

python syntaxpython
typing.Final[T]

Return Value

type qualifier

Typing construct or runtime result as described; static typing rules are not runtime validation.

Working Example

Example Snippetpython
from typing import Final
names: Final[list[str]] = ['Ada']names.append('Lin')print(names)
Python Reference