In python, a directory containing one or more modules sometimes has __init__.py, so that the directory can be treated as a python package, is this correct? What differences the __init__ makes? (also another Q, is a python module just a python code-file with related and possibly independent (to other files) set of classes, functions and variables?)
In python, a directory containing one or more modules sometimes has __init__.py , so
Share
In addition, the contents of
__init__.pybecomes the contents of the package when treated as a module, i.e. the contents ofsomepackage/__init__.pywill be found indir(somepackage)when youimport somepackage.Modules themselves can be Python code, specially-crafted C code, or they could be an artificial construct injected by the executable that loads the Python VM.