Wildcard import
A wildcard import is an import statement that brings eligible exported names from a module, package, object, or namespace into the importing scope.
The Quick Python Book, Fourth Edition
A wildcard import is an import statement form that brings the names exported by a module directly into the importing namespace.
- How it is used
- Imports a module’s exported names directly for concise access, especially in interactive shells or modules designed for wildcard use.
- How deep it goes
- Explains syntax, public-name filtering, __all__, collisions, private-name exceptions, and nonrecursive package behavior without implementation internals.
- Examples
- Demonstrates modtest.py visibility, math–cmath collisions, and package exports through mathproj and its comp subpackage.
- What you can do after
- Apply it via Python import statements while controlling exported names and recognizing collisions, hidden names, and package boundaries.
Read how The Quick Python Book, Fourth Edition explains wildcard import →
Python Workout, Second Edition
A wildcard import imports the names designated for export by a module rather than naming each imported name individually.
- How it is used
- Uses wildcard syntax to import a module’s designated exports without naming each imported name individually.
- How deep it goes
- Defines __all__ through a focused exercise, but does not develop wildcard-import internals or broader trade-offs.
- Examples
- Uses module stuff with variables a, b, c and functions foo, bar to demonstrate selective exports.
- What you can do after
- Build it from scratch by defining __all__ to control names imported with wildcard syntax.
Read how Python Workout, Second Edition explains wildcard import →
Related concepts
- __all__configured by · __all__ is a module-level sequence of names specifying which names a Python module exports for wildcard imports.
- import statementkind of · An import statement is a source-code declaration that makes names or definitions from another module, package, or namespace available in the current scope.
- namespaceuses · A namespace is a naming context or identifier space in which names are defined and resolved, distinguishing them from names in other contexts.
- use declarationuses · A use declaration is Rust syntax that brings names or items from a module or crate into scope for unqualified access.
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.

