Search⌘ K
AI Features

Importing Everything!

Explore how to import modules in Python, focusing on avoiding namespace contamination and shadowing issues. Understand why importing all functions with a wildcard is usually discouraged and learn exceptions like Tkinter where this method is acceptable.

We'll cover the following...

Python provides a way to import all the functions and values from a module as well. This is actually a bad idea as it can contaminate your namespace. A namespace is where all your variables live during the life of the program. So let’s say you have your own variable named sqrt, like this:

Python 3.5
from math import sqrt
sqrt = 5
...