liveBook · Manning

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.

How 2 Manning books explain it

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 →

Also covered in

What to know first

Related concepts

Questions about wildcard import

What is 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.

Which Manning books explain wildcard import?

The Quick Python Book, Fourth Edition and Python Workout, Second Edition.

What should I know before learning wildcard import?

Manning books that teach wildcard import usually introduce function, Python and binding first.

What is wildcard import a kind of?

Wildcard import is a kind of import statement. An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.

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.