from typing import TypedDict, NotRequired class User(TypedDict): name: str age: NotRequired[int] u: User = {'name': 'Ada'} print(u.get('age', 0))