@@ -956,6 +956,8 @@ msgid ""
956956"during import. However, ``__path__`` is typically much more constrained than"
957957" :data:`sys.path`."
958958msgstr ""
959+ "包的 ``__path__`` 属性会在导入其子包期间被使用。 在导入机制内部,它的功能与 :data:`sys.path` "
960+ "基本相同,即在导入期间提供一个模块搜索位置列表。 但是,``__path__`` 通常会比 :data:`sys.path` 受到更多限制。"
959961
960962#: ../../reference/import.rst:627
961963msgid ""
@@ -964,6 +966,8 @@ msgid ""
964966":data:`sys.path_hooks` (described below) are consulted when traversing a "
965967"package's ``__path__``."
966968msgstr ""
969+ "``__path__`` 必须是由字符串组成的可迭代对象,但它也可以为空。 作用于 :data:`sys.path` 的规则同样适用于包的 "
970+ "``__path__``,并且 :data:`sys.path_hooks` (见下文) 会在遍历包的 ``__path__`` 时被查询。"
967971
968972#: ../../reference/import.rst:632
969973msgid ""
@@ -974,17 +978,20 @@ msgid ""
974978"``__path__`` manipulation code; the import machinery automatically sets "
975979"``__path__`` correctly for the namespace package."
976980msgstr ""
981+ "包的 ``__init__.py`` 文件可以设置或更改包的 ``__path__`` 属性,而且这是在 :pep:`420` "
982+ "之前实现命名空间包的典型方式。 随着 :pep:`420` 的引入,命名空间包不再需要提供仅包含 ``__path__`` 操控代码的 "
983+ "``__init__.py`` 文件;导入机制会自动为命名空间包正确地设置 ``__path__``。"
977984
978985#: ../../reference/import.rst:640
979986msgid "Module reprs"
980- msgstr ""
987+ msgstr "模块的 repr "
981988
982989#: ../../reference/import.rst:642
983990msgid ""
984991"By default, all modules have a usable repr, however depending on the "
985992"attributes set above, and in the module's spec, you can more explicitly "
986993"control the repr of module objects."
987- msgstr ""
994+ msgstr "默认情况下,全部模块都具有一个可用的 repr,但是你可以依据上述的属性设置,在模块的规格说明中更为显式地控制模块对象的 repr。 "
988995
989996#: ../../reference/import.rst:646
990997msgid ""
@@ -995,33 +1002,40 @@ msgid ""
9951002"``module.__file__``, and ``module.__loader__`` as input into the repr, with "
9961003"defaults for whatever information is missing."
9971004msgstr ""
1005+ "如果模块具有 spec (``__spec__``),导入机制将尝试用它来生成一个 repr。 如果生成失败或找不到 "
1006+ "spec,导入系统将使用模块中的各种可用信息来制作一个默认 repr。 它将尝试使用 ``module.__name__``, "
1007+ "``module.__file__`` 以及 ``module.__loader__`` 作为 repr 的输入,并将任何丢失的信息赋为默认值。"
9981008
9991009#: ../../reference/import.rst:653
10001010msgid "Here are the exact rules used:"
1001- msgstr ""
1011+ msgstr "以下是所使用的确切规则: "
10021012
10031013#: ../../reference/import.rst:655
10041014msgid ""
10051015"If the module has a ``__spec__`` attribute, the information in the spec is "
10061016"used to generate the repr. The \" name\" , \" loader\" , \" origin\" , and "
10071017"\" has_location\" attributes are consulted."
10081018msgstr ""
1019+ "如果模块具有 ``__spec__`` 属性,其中的规格信息会被用来生成 repr。 被查询的属性有 \" name\" , \" loader\" , "
1020+ "\" origin\" 和 \" has_location\" 等等。"
10091021
10101022#: ../../reference/import.rst:659
10111023msgid ""
10121024"If the module has a ``__file__`` attribute, this is used as part of the "
10131025"module's repr."
1014- msgstr ""
1026+ msgstr "如果模块具有 ``__file__`` 属性,这会被用作模块 repr 的一部分。 "
10151027
10161028#: ../../reference/import.rst:662
10171029msgid ""
10181030"If the module has no ``__file__`` but does have a ``__loader__`` that is not"
10191031" ``None``, then the loader's repr is used as part of the module's repr."
10201032msgstr ""
1033+ "如果模块没有 ``__file__`` 但是有 ``__loader__`` 且取值不为 ``None``,则加载器的 repr 会被用作模块 repr"
1034+ " 的一部分。"
10211035
10221036#: ../../reference/import.rst:665
10231037msgid "Otherwise, just use the module's ``__name__`` in the repr."
1024- msgstr ""
1038+ msgstr "对于其他情况,仅在 repr 中使用模块的 ``__name__``。 "
10251039
10261040#: ../../reference/import.rst:667
10271041msgid ""
0 commit comments