On this page
  1. typing.Final
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

typing.Final

Prev: typing.evaluate_forward_ref | Up: typing | Next: typing.final
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.Final
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import Final

Signature & Overview

typing.Final(*args, **kwds)

Special typing construct to indicate final names to type checkers.

Usage

from typing import Final

MAX_RETRIES: Final[int] = 3
assert MAX_RETRIES == 3

Gotchas

REPL Inspect

from typing import Final
help(Final)

Linked from

Related notes