Why for some modules do we type a '*' for example:
from tkinter import *
and for some of them we don't, like this one:
import time
Why for some modules do we type a '*' for example:
from tkinter import *
and for some of them we don't, like this one:
import time
When importing a package, objects from the package are in a namespace, e.g.,
import time
time.sleep(1)
But when explicitly importing objects from a package, they are imported into the global namespace, e.g.,
from time import sleep
sleep(1)
When using *
instead of a list of object names, all objects from the package are imported into the global namespace and can be used without specifying the package name.