liveBook · Manning

Built-in namespace

The built-in namespace is Python’s namespace containing predefined names available during ordinary name resolution without explicit definition or import.

How 3 Manning books explain it

The Quick Python Book, Fourth Edition

The built-in namespace is the namespace containing Python's predefined names, including built-in functions and exceptions.

How it is used
Provides predefined names as a fallback for direct identifier lookup.
How deep it goes
Explains lookup order, inspection, shadowing, and recovery; defers the complete built-in function reference to Python documentation.
Examples
Demonstrates shadowing list, restoring it with del, inspecting built-in names, and reading max documentation.
What you can do after
Diagnose/debug with namespace inspection and recover from an accidentally shadowed built-in name.

Read how The Quick Python Book, Fourth Edition explains built-in namespace →

Python Workout: 50 ten-minute exercises

The built-ins namespace is Python's namespace containing names available as a final fallback during ordinary name resolution, including built-in functions and types.

How it is used
Resolves ordinary names after local, enclosing, and global namespaces have been searched.
How deep it goes
Explains lookup order and shadowing with a failure example, but stops short of namespace implementation internals.
Examples
Uses int, range, sum, a shadowing error, pylint, lists, dicts, and os imports.
What you can do after
Diagnose/debug with it by recognizing built-in shadowing and distinguishing built-ins from modules requiring import.

Read how Python Workout: 50 ten-minute exercises explains built-in namespace →

Python Workout, Second Edition

builtins is Python's namespace and module containing names automatically available to Python code.

How it is used
Resolves unqualified names after globals in LEGB lookup, making common types and functions available without global definitions.
How deep it goes
Explains lookup order and shadowing consequences, including the resulting TypeError from calling a shadowed name.
Examples
Uses int('s'), a shadowed sum variable, sum([...]), and pylint or ruff diagnostics.
What you can do after
Diagnose name-resolution errors by checking globals before built-ins and identifying collisions such as sum.

Read how Python Workout, Second Edition explains built-in namespace →

What to know first

Related concepts

Questions about built-in namespace

What is built-in namespace?

The built-in namespace is Python’s namespace containing predefined names available during ordinary name resolution without explicit definition or import.

Which Manning books explain built-in namespace?

The Quick Python Book, Fourth Edition, Python Workout: 50 ten-minute exercises and Python Workout, Second Edition.

What should I know before learning built-in namespace?

Manning books that teach built-in namespace usually introduce namespace and function first.

What is the difference between built-in namespace and shadowing?

The built-in namespace is Python’s namespace containing predefined names available during ordinary name resolution without explicit definition or import. Shadowing is the concealment of an existing name binding or inherited property by a nearer declaration or property with the same name.

What is built-in namespace a kind of?

Built-in namespace is a kind of namespace. A global namespace is a top-level naming context that binds identifiers defined at the outermost level and distinguishes them from names in nested scopes.

What are the parts of built-in namespace?

Built-in namespace includes built-in function.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.