By the way, I use the word
attribute
for any name following a dot — for example, in the expression
z.real
,
real
is an attribute of the object
z
. Strictly speaking, references to names in modules are attribute references: in the expression
modname.funcname
,
modname
is a module object and
funcname
is an attribute of it. In this case there happens to be a straightforward mapping between the module’s attributes and the global names defined in the module: they share the same namespace!
[1]
Python "Attribute" Definition
最新推荐文章于 2021-01-14 23:12:26 发布