The built-in namespace supplies Python’s predefined names, including functions such as len, max, and list and exceptions such as NameError. It is the namespace associated with __builtins__. section 10.7
When Python encounters an unqualified name, it searches in this order:
- The local namespace, then the global namespace. section 10.7
- The built-in namespace. If the name is absent there too, Python raises NameError. section 10.7
A local binding hides a built-in
list("Peyto Lake") returns a list of characters. After `list = [1, 3, 5, 7]`, the same call raises `TypeError: 'list' object is not callable`: the new binding is found before the built-in function. `del list` removes that binding and makes the built-in available again. section 10.7.1
Use `dir(__builtins__)` to inspect built-in names, and `help()` or an object’s `__doc__` to inspect documentation. For a suspected mistyped local name, `dir()` without an argument lists local identifiers. section 10.7.1
Methods also look up unqualified names through local, global, and built-in namespaces. That search is distinct from accessing instance, class, and superclass names through `self`. section 15.11


