简体   繁体   English

什么是外部库的Python推荐名称?

[英]What is the Python's recommended name for the external libraries?

Everyone seems to use different terms for this, such as modules, packages, libraries and whatnot. 每个人似乎都使用不同的术语,例如模块,包,库等等。 Is there a PEP recommended/encouraged term? 是否有推荐/鼓励的PEP术语?

A module and package are fairly well defined in Python, insofar as they represent very specific organizational code units. 模块在Python中定义得非常好,因为它们代表了非常具体的组织代码单元。

Quoting from the Glossary : 引用词汇表

Module: An object that serves as an organizational unit of Python code. 模块:作为Python代码的组织单元的对象。 Modules have a namespace containing arbitrary Python objects 模块具有包含任意Python对象的命名空间

Package: (...) Technically, a package is a Python module with an __path__ attribute. 包:(...)从技术上讲,包是一个带有__path__属性的Python模块。

I am not aware of a PEP that defines other terms such as external library . 我不知道PEP定义了其他术语,如外部库

Best thing is to check the Python's documentation. 最好的方法是检查Python的文档。 Quoting from https://docs.python.org/3/tutorial/modules.html#packages : 引自https://docs.python.org/3/tutorial/modules.html#packages

Packages are a way of structuring Python's module namespace by using “dotted module names”. 包是一种使用“点模块名称”构造Python模块命名空间的方法。 For example, the module name AB designates a submodule named B in a package named A. Just like the use of modules saves the authors of different modules from having to worry about each other's global variable names, the use of dotted module names saves the authors of multi-module packages like NumPy or Pillow from having to worry about each other's module names. 例如,模块名称AB在名为A的包中指定名为B的子模块。就像使用模块保存不同模块的作者不必担心彼此的全局变量名一样,使用点模块名称可以保存作者NumPy或Pillow等多模块软件包不必担心彼此的模块名称。

As for libraries, I haven't heard this being used officially in the Python literature. 至于图书馆,我还没有听说过在Python文献中正式使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM