Skip to content

Chapter 3 of 7

The Any type and unconstrained mappings

Any is not a place in the type hierarchy, it is an instruction to the checker to stop checking, and it spreads: anything indexed out of a dict[str, Any] is Any too, so one loose signature can leave a whole call graph unverified. This chapter traces where Any enters a program, why an unconstrained mapping also hides which keys exist, how to count the unchecked expressions per module, and where Any is still the honest annotation.

Python for AI work — read the current version at https://daviddominguez.dev/learn/en/python-for-ai-work/the-any-type-and-unconstrained-mappings

Back to top