Skip to main content
Loading page…
Python Mastery
Chapter 7
Lesson 1 of 4
The Import System
Contents
Notes
Tutor
Concept
What Is a Module?
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
22 min
9 activities
0 of 9 done
In this lesson
1
What Is a Module?
2
Four Import Styles
3
Inspecting a Module Object
4
How Python Resolves Import Paths
5
What Does `import math` Actually Do?
6
Gotcha: Shadowing Standard-Library Modules
7
Wildcard Import Danger
8
Practice: Import and Explore
9
Pro Tip: Use dir() and help() at the REPL
Objectives
Use import x, from x import y, and as aliasing correctly
Describe what Python actually does when a module is imported
Inspect a module object with dir() and __dunder__ attributes
Distinguish standard-library, third-party, and local modules and explain why wildcard imports are dangerous
Chapter 7 · Modules, Packages & Imports
The Import System
Writing Your Own Modules
Packages & Project Layout
pip, PyPI & Dependencies
Previous: Recursion & Lambdas
Next: Writing Your Own Modules