On this page
typing.final
Prev: typing.Final | Up: typing | Next: typing.ForwardRef
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(f)
Decorator to indicate final methods and final classes.
Usage
from typing import final
@final
class Sealed:
pass
assert Sealed.__final__ is True
Gotchas
- Static check only: Marks a class as non-subclassable or a method as non-overridable for type checkers; Python does not block subclassing at runtime.
REPL Inspect
from typing import final
help(final)
Linked from
Related notes
- tuts/python3/stdlib_module/typing/Final Linked here; links to this page; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/ForwardRef Linked here; links to this page; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/typing/AbstractSet Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/Annotated Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/Any Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/assert_never Linked here; shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/assert_type shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/AsyncContextManager shared tags: #stdlib, #typing
- tuts/python3/stdlib_module/typing/AsyncGenerator shared tags: #stdlib, #typing