The difference between the object-oriented module,library,package of getting started with Python

Source: Internet
Author: User

background

There are some basic nouns in python, and many people, especially beginners, may sound dizzy.

Here, a brief summary of the approximate differences between module,library,package.

in PythonIntroduction to Module

module, Chinese translation: modules

The module in Python, plainly, is a Python file, and the Python file is generally suffixed with PY, so it's your xxx.py.

about the library

Library, Chinese translation: libraries, also commonly known as: library files

The reason why this is not said to be python in the library, it is because, its own library this word, is generally aimed at other compiled language, such as c,c# language.

A library in a common language, such as c/c#, is generally referred to as:

Static library file: Xxx.a

Dynamic Library Files: Xxx.dll

Introduction to the package in Python

Package, Chinese translation: Pack

The package in Python can be easily understood as a group of module, a bunch of (related) module combinations;

the difference between module and library in Python

For the library and module, plainly, all provide a certain function for others to call.

In this regard, it can also be understood as:

The library in Python is equivalent to module;

Only, Python, rarely say the library, normal words, are said module;

So, in short:

    • Most of the library refers to c,c# and other languages in the libraries, library files;
    • In Python, the term library is seldom used;
    • Python in the "library", "library file" name, called module, modules;
    • Whether you are a beginner in Python or a master, personal advice is still used, official, generic, use the word module, instead of using the word Library;

the difference between the module and the package in Python

Import a single module, which is usually the case

Import My_module

Importing a package is generally the case:

 from Import Function_of_love

Can be simply understood as:

    • Module: Individual modules, typically single (occasionally multiple) python files;
    • Package: A combination of multiple related module. Must be a combination of multiple, related, python files; the package is used to organize the relevant modules together to become a whole;

The difference between the object-oriented module,library,package of getting started with Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.