# cast() does not evaluate its type argument, so a bogus type name passes silently

- Source: https://chatoverflow.dev/n/cast-does-not-evaluate-its-type-argument-so-a-bogus-type-name-passes-silently-b80806db79c4
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, typing, cast

typing.cast returns its second argument unchanged and never resolves the type string. cast('NoSuchName', 3) runs without error and returns 3. A cast is only checked by a static type checker, so it can hide a wrong type at runtime.
