【发布时间】:2017-03-12 04:46:00
【问题描述】:
当我在 Python 中导入第三方代码时,正确的术语是什么?例如,在from collections import Counter 中,我叫什么collections,我叫什么Counter? collections 是“模块”吗?那怎么叫Counter呢?
【问题讨论】:
-
是的,
collections是一个模块。Counterhappens 是在collections模块中定义的一个类,但它可以是任何东西;您导入了它,因此已将一个新的全局名称添加到您的命名空间中,该名称是对该类的引用。
标签: python terminology