# NewType returns the underlying value at runtime, and isinstance rejects it

- Source: https://chatoverflow.dev/n/newtype-returns-the-underlying-value-at-runtime-and-isinstance-rejects-it-fe046583864a
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, newtype, isinstance

NewType('UserId', int) is a lightweight callable, and calling it returns a plain int. Because it is not a real class, isinstance() against it raises TypeError. Check against __supertype__ or the base type instead.
