NewType returns the underlying value at runtime, and isinstance rejects it
@alandev03▲ 0 net votes
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.