PEP 8 states
Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools.
Nonetheless the official documentation is contradicting:
to use Tkinter all you need is a simple import statement:
import tkinter
Or, more often:
from tkinter import *
Is this a "documentation bug" ?
I raised bug issue 32830 on this point and the consensus (reached by Python core developers) is that although the from tkinter import *
does violate PEP 8, this is a reasonable exception because tkinter
"provides the enormous number of names (mostly constants like RIGHT or VERTICAL) which are convenient to use without prefix." Additionally, PEP 8 states "do not break backwards compatibility just to comply with this PEP!" and since tkinter is frequently imported in this way currently, this sentiment applies here.