"Module", "package", and "library" are words I often hear, but I didn't really understand the difference, so I looked them up and summarized them. When I was researching, there were many articles that assumed Python, so I will proceed with this article assuming Python as well. It is unclear whether the same theory can be applied to other languages, but I think there is probably something that can be applied.
A module is a file created by .py
. Save the contents to a .py
file when writing a somewhat long program. And when you want to use it, call it as a module with import from another Python file. Of course, the classes and functions stored in the called module can also be used at the callee.
A package is a collection of several modules organized into directories. If there are multiple modules with similar functions, it is easier to handle them together. When you call a package with import, you can use the contents of all the modules in the package.
A library is a collection of several packages that can be installed. There are two types of libraries: ** standard library ** that comes with Python and can be used immediately, and ** external library ** that is used after additional installation such as download. "TensorFlow" used in machine learning, Matplotlib used for graph drawing, Pandas (Pandas) that provides functions to support data analysis, etc. are all external libraries.
Library> Package> Module
Thorough explanation of Python modules, packages, and libraries!
Recommended Posts