@@ -1382,6 +1382,8 @@ msgid ""
1382
1382
" have a :attr:`!__path__` attribute. See :ref:`package-path-rules` for more "
1383
1383
"details."
1384
1384
msgstr ""
1385
+ "一个(可能为空的)枚举用于查找包的子模块的位置的由字符串组成的 :term:`sequence`。 非包模块应当没有 :attr:`!__path__`"
1386
+ " 属性。 详情参见 :ref:`package-path-rules`。"
1385
1387
1386
1388
#: ../../reference/datamodel.rst:1029
1387
1389
msgid ""
@@ -1390,13 +1392,18 @@ msgid ""
1390
1392
"<importlib.machinery.ModuleSpec.submodule_search_locations>` instead of "
1391
1393
":attr:`!module.__path__`."
1392
1394
msgstr ""
1395
+ "**强烈** 建议你使用 :attr:`module.__spec__.submodule_search_locations "
1396
+ "<importlib.machinery.ModuleSpec.submodule_search_locations>` 来代替 "
1397
+ ":attr:`!module.__path__`。"
1393
1398
1394
1399
#: ../../reference/datamodel.rst:1036
1395
1400
msgid ""
1396
1401
":attr:`!__file__` and :attr:`!__cached__` are both optional attributes that "
1397
1402
"may or may not be set. Both attributes should be a :class:`str` when they "
1398
1403
"are available."
1399
1404
msgstr ""
1405
+ ":attr:`!__file__` 和 :attr:`!__cached__` 都是可设也可不设的可选属性。 两个属性在可用时都应当为 "
1406
+ ":class:`str`。"
1400
1407
1401
1408
#: ../../reference/datamodel.rst:1040
1402
1409
msgid ""
@@ -1408,6 +1415,9 @@ msgid ""
1408
1415
"<importsystem>` may opt to leave it unset if it has no semantic meaning (for"
1409
1416
" example, a module loaded from a database)."
1410
1417
msgstr ""
1418
+ ":attr:`!__file__` 指明要载入的模块所在文件的路径名(如果是从文件载入),或者对于从共享库动态载入的扩展模块来说则是共享库文件的路径名。"
1419
+ " 它对于特定类型的模块来说可能是缺失的,例如静态链接到解释器中的 C 模块,并且 :ref:`导入系统 <importsystem>` "
1420
+ "也可能会在它没有语法意义时选择不设置它(例如,当一个模块是从数据库导入时)。"
1411
1421
1412
1422
#: ../../reference/datamodel.rst:1048
1413
1423
msgid ""
@@ -1417,6 +1427,9 @@ msgid ""
1417
1427
"attribute; the path can simply point to where the compiled file *would* "
1418
1428
"exist (see :pep:`3147`)."
1419
1429
msgstr ""
1430
+ "如果设置了 :attr:`!__file__` 则 :attr:`!__cached__` "
1431
+ "属性也可能会被设置,它是指向任何代码的已编译版本的路径(例如,一个字节码文件)。 设置此属性并不需要存在相应的路径;该路径可以简单地指向已编译文件 "
1432
+ "*将要* 存在的位置 (参见 :pep:`3147`)。"
1420
1433
1421
1434
#: ../../reference/datamodel.rst:1054
1422
1435
msgid ""
0 commit comments