A binding associates a name with an object in a namespace. Python variables are labels for objects, not containers that hold them. Assignment creates a name when it is first used; no variable type declaration is needed. Types belong to objects, so the same name can later refer to an object of another type. section 4.3 section 1.3.2 section 10.7
Rebinding a name
After `x = "2"`, `x` refers to a string. After `x = int(x)`, it refers to the integer `2`. The name has not acquired a fixed type. section 1.3.2
a = [1, 2, 3] b = a c = b b[1] = 5 print(a, b, c) [1, 5, 3] [1, 5, 3] [1, 5, 3]
Three names refer to the same list. Changing that list through `b` is visible through `a` and `c` too; this is different from assigning a new object to `b`. section 4.3
Lookup checks the local namespace, then the global namespace, then built-ins. At module level, creating a variable, defining a function, or importing a name adds a binding. A function call creates a local namespace with bindings for its parameters; assignments inside the function add local bindings. A nearer binding can hide a built-in: naming a variable `list` prevents ordinary lookup of the built-in `list`. Deleting a name removes its binding, so looking it up afterward can raise `NameError`. section 10.7 section 4.3
Assignment can bind names to more than simple values:
- Bind a function to another name and call it through that name; reassignment can select a different function. section 9.5
- Unpack values into several names at once: `a, b = 1, 2`. Swap their bindings with `a, b = b, a`. section 5.7.3










