我正在读sourcode为Python项目和整个下面的行来了:Python的导入对象的一个模块中的源于不同的模块到第三模块
from couchexport.export import Format
(来源:https://github.com/wbnigeria/couchexport/blob/master/couchexport/views.py#L1)
我去了couchexport/export.py
看看Format
是什么(Class?Dict?别的?)。不幸的是Format
不在该文件中。 export.py
确实从couchexport.models导入Format
,其中是 a Format
类(来源:https://github.com/wbnigeria/couchexport/blob/master/couchexport/models.py#L11)。
当我在我的IDE中打开原始文件并让它查找声明时,我在本问题开始时提到了它,它直接导致了models.py。
发生了什么事?如何从一个文件导入(export.py
)实际上是从另一个文件导入(models.py
)而未明确说明?
我不确定#1说什么问题。 – DSM 2012-04-07 11:15:56
@DSM:澄清:) – 2012-04-07 11:26:54
我认为这可能是一个未翻译的习惯用语,但由于'type'意味着Python中的某些东西,所以我不确定。 :^) – DSM 2012-04-07 11:30:17