[PYTHON] [Note] Classes, modules, packages, libraries

Introduction

I will proceed with the discussion based on Python. maybe. For the time being, I will summarize the terms and finally the inclusive relations.

class##

The class has * attributes *. Attributes are * data attributes * and * methods *.

Data attributes

Method

A * function * in a class. It's a child who does various processing.

module##

A * Python file * with the extension .py. Various definitions (variables and functions) are written in this file. There is also an executable statement (for initializing the module).

package##

A collection of multiple modules.

A way to structure module namespaces using "dotted module names" https://docs.python.org/ja/3/tutorial/modules.html#packages

In other words, thanks to this package, you can refer to various modules, and even if there is a function with the same name, you can use it well. Thank you and thank you.

By the way, pip is a package management tool.

Library##

A collection of multiple packages.

Inclusion relationship

It's like * library ⊇ package ⊇ module *.

What was confusing

Isn't it similar to a class that you can refer to a module with a dot operator like an object reference? Also, there are too many names.

reference#

Python official documentation (Japanese) I think it's different, but I used it as a reference Modules and packages in Python are "namespaces"

Recommended Posts

[Note] Classes, modules, packages, libraries
Python packages and modules
Understand Python packages and modules
Python: A Note About Classes 1 "Abstract"
Python Basic Course (14 Modules and Packages)