Skip to content
masterclass Buddy

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.

Subscribe
  • TypeVar
  • Generic
  • Protocol
  • TypedDict

Source: typing — Support for type hints — Python 3.15.2 documentation. Checked 2026-11-03.