Python has something called wildcard imports, which look like from module import *. This type of import allows you to quickly get all the objects from a module into your namespace. However, using this import on a package can be confusing because it’s not clear what you want to import: subpackages, modules, objects? Python has the __all__ variable to work around this issue.
The __all__ variable is a list of strings where each string represents the name of a variable, function, class, or module that you want to expose to wildcard imports.
In this video course, you’ll:
- Understand wildcard imports in Python
- Use
__all__to control the modules that you expose to wildcard imports - Control the names that you expose in modules and packages
- Explore other use cases of the
__all__variable - Learn some benefits and best practices of using
__all__
To get the most out of this course, you should be familiar with a few Python concepts, including modules and packages, and the import system.
What’s Included:
- 11 Lessons
- Video Subtitles and Full Transcripts
- 2 Downloadable Resources
- Accompanying Text-Based Tutorial
- Interactive Quiz to Check Your Progress
- 2 Hands-On Coding Exercises
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Downloadable Resources: