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

Taught in

References

Certification courses