@@ -1028,12 +1028,17 @@ msgid ""
10281028"module object does not contain the code object used to initialize the module"
10291029" (since it isn't needed once the initialization is done)."
10301030msgstr ""
1031+ "模块是 Python 代码的基本组织单位,模块是由 :ref:`导入系统 <importsystem>` 通过使用用 :keyword:`import`"
1032+ " 语句 (参见 :keyword:`import`) 或调用 :func:`importlib.import_module` 以及内置的 "
1033+ ":func:`__import__` 等函数来创建的。每个模块对象都有一个独立的命名空间,它是通过一个字典对象实现的 (就是由在模块中定义的函数的 "
1034+ "``__globals__`` 属性所引用的字典)。属性引用会被转化为在此字典中查找,例如 ``m.x`` 等同于 "
1035+ "``m.__dict__[\" x\" ]``。一个模块对象不包含用来初始化该模块的代码对象 (因为这种对象在初始化完成后就不再需要)。"
10311036
10321037#: ../../reference/datamodel.rst:711
10331038msgid ""
10341039"Attribute assignment updates the module's namespace dictionary, e.g., ``m.x "
10351040"= 1`` is equivalent to ``m.__dict__[\" x\" ] = 1``."
1036- msgstr ""
1041+ msgstr "属性赋值会更新模块的命名空间字典,例如 ``m.x = 1`` 等同于 ``m.__dict__[ \" x \" ] = 1``。 "
10371042
10381043#: ../../reference/datamodel.rst:721
10391044msgid ""
@@ -1048,12 +1053,17 @@ msgid ""
10481053"loaded dynamically from a shared library, it is the pathname of the shared "
10491054"library file."
10501055msgstr ""
1056+ "预定义的 (可写) 属性: :attr:`__name__` 为模块的名称; :attr:`__doc__` 为模块的文档字符串,如果没有则为 "
1057+ "``None``; :attr:`__annotations__` (可选) 为一个包含 :term:`变量标注 <variable "
1058+ "annotation>` 的字典,它是在模块体执行时获取的; :attr:`__file__` "
1059+ "是模块对应的被加载文件的路径名,如果它是加载自一个文件的话。某些类型的模块可能没有 :attr:`__file__` 属性,例如 C "
1060+ "模块是静态链接到解释器内部的; 对于从一个共享库动态加载的扩展模块来说该属性为该共享库文件的路径名。"
10511061
10521062#: ../../reference/datamodel.rst:734
10531063msgid ""
10541064"Special read-only attribute: :attr:`~object.__dict__` is the module's "
10551065"namespace as a dictionary object."
1056- msgstr ""
1066+ msgstr "特殊的只读属性: :attr:`~object.__dict__` 为以字典对象表示的模块命名空间。 "
10571067
10581068#: ../../reference/datamodel.rst:739
10591069msgid ""
@@ -1062,10 +1072,12 @@ msgid ""
10621072"still has live references. To avoid this, copy the dictionary or keep the "
10631073"module around while using its dictionary directly."
10641074msgstr ""
1075+ "由于 CPython "
1076+ "清理模块字典的设定,当模块离开作用域时模块字典将会被清理,即使该字典还有活动的引用。想避免此问题,可复制该字典或保持模块状态以直接使用其字典。"
10651077
10661078#: ../../reference/datamodel.rst:801
10671079msgid "Custom classes"
1068- msgstr ""
1080+ msgstr "自定义类 "
10691081
10701082#: ../../reference/datamodel.rst:745
10711083msgid ""
0 commit comments