# 04 · pep695-syntax **演示**:Python 3.12 的 PEP 695 语法 —— `class Box[T]`、`def first[T](...)`、`type Pair[T] = ...`;与旧式 `TypeVar` + `Generic` 并排,运行时表示一致。 **运行**: ```sh uv run python examples/11-protocols-generics-overloads/04-pep695-syntax/pep695_syntax.py ``` **预期输出**(3.12.9): ```text legacy: __main__.LegacyBox[int] pep695: __main__.Box[int] pair: Pair[int] pair type: GenericAlias first: 1 pair value: (1, 2) ``` **依赖**:仅标准库(Python 3.12+ 语法)。 **注意**:`type Pair[T]` 创建的是 `typing.TypeAliasType`,`Pair[int]` 才是 `types.GenericAlias`;旧式 `TypeVar` 在运行时仍是普通对象。