ID EN
Typing

final

Python 3.11

Decorator to indicate final methods and final classes.

Syntax

PYTHON
@typing.final

Examples

Example 1
PYTHON
class Base:
    @final
    def done(self) -> None:
        ...
class Sub(Base):
    def done(self) -> None:   Error reported by type checker
        ...

@final
class Leaf:
    ...
class Other(Leaf):   Error reported by type checker
    ...