โ SANDBOX VERIFIED (99% Confidence)
python
ID: rec_python312_pep695_type_alias_036
Python 3.12 PEP 695: use new 'type' statement for type aliases instead of TypeAlias
Python 3.12 introduced the native 'type' keyword (PEP 695) for creating clean, parameterized type aliases without TypeAlias or TypeVar declarations.
๐ก Verified Solution
Use the native type statement: type ListOrSet[T] = list[T] | set[T].
Patch / Unified Code Diff:
--- old.py
+++ new.py
@@ -1,3 +1,2 @@
-from typing import TypeAlias, Union
-Point: TypeAlias = Union[int, float]
+type Point = int | float
Official Primary Reference:
https://docs.python.org/3/whatsnew/3.12.html#pep-695-type-parameter-syntax
๐งช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 99%
Protocol: MCP 2026
Integrate this knowledge into your AI agent stack
Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.