Names as bindings and dynamic typing
In Python a variable is a name bound to an object, not a typed box that holds a value. The type lives on the object (every object carries a pointer to its type), never on the name. So there is nothing to declare: the assignment statement itself creates or rebinds the name. x = 10 creates an int object (or reuses a cached one) and binds x to it. x = 'hi' later just points x at a different object; the int is untouched and is freed only if nothing else references it.
Internally, in CPython the compiler decides the storage class of each name per scope. Locals in a function live in a fast array on the frame (STORE_FAST), module and class-level names live in a dict (STORE_NAME / STORE_GLOBAL). Binding writes a pointer and adjusts reference counts. Type checks happen at operation time: x + y dispatches to type(x).add and falls back to type(y).radd, raising TypeError if neither handles it. That is why it is called dynamic (types resolved at run time) but strong (no silent coercion of str + int).
Trade-offs: dynamic typing gives flexibility, less boilerplate and easy duck typing, but moves a class of bugs from compile time to run time and makes large refactors riskier. At scale I'd pair it with type hints plus mypy or pyright in CI, accepting that hints are not enforced at runtime (use pydantic or beartype if you need runtime validation). Statically typed languages can also optimize better; CPython 3.11+ partly closes the gap with the specializing adaptive interpreter, which speculates on types seen at each bytecode site.
Common mistakes: believing b = a copies the data, believing assignment 'changes the variable's type' (it rebinds to a different object), and being surprised by UnboundLocalError - if a function assigns to a name anywhere, that name is local for the whole function, so reading it earlier fails. That error is a good demonstration that name scoping is decided at compile time even though types are decided at run time.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience