Robots Atlas>ROBOTS ATLAS

Python — From Basics to Advanced · Advanced Typing

Literal, Final, Annotated

Advanced Typing

Introduction

Literal restricts a value to specific constants (string/int/Enum) — enum-like signatures without an Enum class. Final blocks reassignment and override (constants, sealed attributes). Annotated attaches metadata to a type — used by Pydantic, FastAPI, msgspec, typer.