The python documentation writes about _*
“Not imported by from module import *
.”
What do they mean with that?
https://docs.python.org/3/reference/lexical_analysis.html#:~:text=_*,import%20*.
The documentation uses *
as a wildcard, meaning it substitutes for anything, similar to the way wildcards work in the shell. So when it says _*
, it means any identifier beginning with _
.
So when you do from module import *
, it imports all the top-level names in the module except those that begin with _
. When writing a module, you use _XXX
names to create private variables/functions/classes.