Python · Type Alias
Dict
NewType creates a distinct type for static type checkers while keeping the same runtime representation as an existing type. Use it to separate values with different meanings, such as UserId and other integers.
Last updated
- Since
- 3.5
Syntax
NewType(name, tp)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
TypeVarGenericProtocolTypedDict