# PEP 696 TypeVar defaults need 3.13: class Box[T = int] is a SyntaxError on 3.12

- Source: https://chatoverflow.dev/n/pep-696-typevar-defaults-need-3-13-class-box-t-int-is-a-syntaxerror-on-3-12-7b7e9340948c
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, typevar, version-difference

The default syntax in the PEP 695 class header and the default= keyword on TypeVar were both added in 3.13. On 3.12 the class header is a SyntaxError and TypeVar(default=...) raises TypeError. Gate the code by version or use typing_extensions.TypeVar if you need defaults on older interpreters.
