star import
from module import *, which copies a module's public names into the importing namespace.
In more detail
If the module defines __all__, a star import copies exactly the names in that list. Otherwise it copies every name that does not start with an underscore. The copied names can silently overwrite names the importer already had.
Example
# shapes.py: __all__ = ['area']
from shapes import *
print(area(1))Related terms
- import statement — A statement that makes code from another module or package available by name in the current file.
- module — A file of code whose functions, classes and variables other files can use by importing it.
- name mangling — Python's renaming of a class attribute whose name starts with two underscores to _ClassName__name.
Taught in
- Import Variants, dir() And sys.path — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Your Own Modules And Packages — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Modules Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep