@@ -433,8 +433,8 @@ msgid ""
433433" authors of multi-module packages like NumPy or Pillow from having to worry "
434434"about each other's module names."
435435msgstr ""
436- "包是一种用“带点号的模块名 ”构造 Python 模块命名空间的方法。例如,模块名 :mod:`A.B` 表示 ``A`` 包中名为 ``B`` "
437- "的子模块。正如模块可以区分不同模块之间的全局变量名称一样,使用点号模块名可以区分 NumPy 或 Pillow 等不同多模块包之间的模块名称。"
436+ "包是一种用“点式模块名 ”构造 Python 模块命名空间的方法。例如,模块名 :mod:`A.B` 表示包 ``A`` 中名为 ``B`` "
437+ "的子模块。正如模块可以区分不同模块之间的全局变量名称一样,点式模块名可以区分 NumPy 或 Pillow 等不同多模块包之间的模块名称。"
438438
439439#: ../../tutorial/modules.rst:392
440440msgid ""
@@ -450,10 +450,9 @@ msgid ""
450450"operations. Here's a possible structure for your package (expressed in "
451451"terms of a hierarchical filesystem):"
452452msgstr ""
453- "假设要为统一处理声音文件与声音数据设计一个模块集合 (“包”)。声音文件的格式很多(通常以扩展名来识别,例如::file:`.wav`, "
453+ "假设要为统一处理声音文件与声音数据设计一个模块集 (“包”)。声音文件的格式很多(通常以扩展名来识别,例如::file:`.wav`, "
454454":file:`.aiff`, "
455- ":file:`.au`),因此,为了不同文件格式之间的转换,需要创建和维护一个不断增长的模块集合。可能还要实现对声音数据的不同处理(例如,混声、添加回声、均衡器功能、创造人工立体声效果),"
456- " 为了实现这些操作,还要编写一个无穷无尽的模块流。下图以分级文件系统形式展示这个包的架构:"
455+ ":file:`.au`),因此,为了不同文件格式之间的转换,需要创建和维护一个不断增长的模块集合。为了实现对声音数据的不同处理(例如,混声、添加回声、均衡器功能、创造人工立体声效果),还要编写无穷无尽的模块流。下图以分级文件系统形式展示这个包的架构:"
457456
458457#: ../../tutorial/modules.rst:429
459458msgid ""
@@ -470,21 +469,21 @@ msgid ""
470469"can just be an empty file, but it can also execute initialization code for "
471470"the package or set the ``__all__`` variable, described later."
472471msgstr ""
473- "Python 只把含 :file:`__init__.py` 文件的目录当成包。这样做是为了防止以 ``string`` "
474- "等通常名称命名的目录,无意中屏蔽后面模块搜索路径中出现的有效模块 。 最简情况下,:file:`__init__.py` "
475- "可以只是一个空文件,但该文件也可以执行包的初始化代码或设置 ``__all__`` 变量,详见下文。"
472+ "Python 只把含 :file:`__init__.py` 文件的目录当成包。这样可以防止以 ``string`` "
473+ "等通用名称命名的目录,无意中屏蔽出现在后方模块搜索路径中的有效模块 。 最简情况下,:file:`__init__.py` "
474+ "只是一个空文件,但该文件也可以执行包的初始化代码,或设置 ``__all__`` 变量,详见下文。"
476475
477476#: ../../tutorial/modules.rst:439
478477msgid ""
479478"Users of the package can import individual modules from the package, for "
480479"example::"
481- msgstr "包的用户可以从包中导入单个模块 ,例如:"
480+ msgstr "还可以从包中导入单个模块 ,例如:"
482481
483482#: ../../tutorial/modules.rst:444
484483msgid ""
485484"This loads the submodule :mod:`sound.effects.echo`. It must be referenced "
486485"with its full name. ::"
487- msgstr "这段代码导入子模块 :mod:`sound.effects.echo` 。 但引用时必须使用子模块的全名:"
486+ msgstr "这段代码加载子模块 :mod:`sound.effects.echo` , 但引用时必须使用子模块的全名:"
488487
489488#: ../../tutorial/modules.rst:449
490489msgid "An alternative way of importing the submodule is::"
@@ -494,19 +493,19 @@ msgstr "另一种导入子模块的方法是 :"
494493msgid ""
495494"This also loads the submodule :mod:`echo`, and makes it available without "
496495"its package prefix, so it can be used as follows::"
497- msgstr "这样也可以导入子模块 :mod:`echo` ,并且不加包前缀也有效 。因此,可以按如下方式使用:"
496+ msgstr "这段代码还可以加载子模块 :mod:`echo` ,并且不加包前缀也可以使用 。因此,可以按如下方式使用:"
498497
499498#: ../../tutorial/modules.rst:458
500499msgid ""
501500"Yet another variation is to import the desired function or variable "
502501"directly::"
503- msgstr "另一种形式是直接导入所需的函数或变量 :"
502+ msgstr "另一种变体是直接导入所需的函数或变量 :"
504503
505504#: ../../tutorial/modules.rst:462
506505msgid ""
507506"Again, this loads the submodule :mod:`echo`, but this makes its function "
508507":func:`echofilter` directly available::"
509- msgstr "同样,这样也会导入子模块 :mod:`echo`,但可以直接使用函数 :func:`echofilter`:"
508+ msgstr "同样,这样也会加载子模块 :mod:`echo`,但可以直接使用函数 :func:`echofilter`:"
510509
511510#: ../../tutorial/modules.rst:467
512511msgid ""
@@ -517,9 +516,9 @@ msgid ""
517516"it is a module and attempts to load it. If it fails to find it, an "
518517":exc:`ImportError` exception is raised."
519518msgstr ""
520- "请注意,当使用 ``from package import item`` "
521- "时,item可以是包的子模块 (或子包),也可以是包中定义的其他名称,如函数,类或变量。 ``import`` "
522- "语句首先测试是否在包中定义了item;如果没有,它假定它是一个模块并尝试加载它。如果找不到它,则引发 :exc:`ImportError` 异常。"
519+ "注意,使用 ``from package import item`` 时,item "
520+ "可以是包的子模块 (或子包),也可以是包中定义的函数、类或变量等其他名称。 ``import`` 语句首先测试包中是否定义了 "
521+ "item;如果未在包中定义,则假定 item 是模块,并尝试加载。如果找不到 item,则触发 :exc:`ImportError` 异常。"
523522
524523#: ../../tutorial/modules.rst:474
525524msgid ""
@@ -528,8 +527,8 @@ msgid ""
528527" a package but can't be a class or function or variable defined in the "
529528"previous item."
530529msgstr ""
531- "相反,当使用 ``import item.subitem.subsubitem`` "
532- "这样的语法时,除了最后一项之外的每一项都必须是一个包 ;最后一项可以是模块或包,但不能是前一项中定义的类或函数或变量 。"
530+ "相反,使用 ``import item.subitem.subsubitem`` 句法时,除最后一项外,每个 item "
531+ "都必须是包 ;最后一项可以是模块或包,但不能是上一项中定义的类、函数或变量 。"
533532
534533#: ../../tutorial/modules.rst:483
535534msgid "Importing \\ * From a Package"
@@ -543,8 +542,8 @@ msgid ""
543542"could take a long time and importing sub-modules might have unwanted side-"
544543"effects that should only happen when the sub-module is explicitly imported."
545544msgstr ""
546- "当用户写 ``from sound.effects import *`` "
547- "会发生什么 ?理想情况下,人们希望这会以某种方式传递给文件系统,找到包中存在哪些子模块,并将它们全部导入。这可能需要很长时间,导入子模块可能会产生不必要的副作用 ,这种副作用只有在显式导入子模块时才会发生。"
545+ "使用 ``from sound.effects import *`` "
546+ "时会发生什么 ?理想情况下,该语句在文件系统查找并导入包的所有子模块。这项操作花费的时间较长,并且导入子模块可能会产生不必要的副作用 ,这种副作用只有在显式导入子模块时才会发生。"
548547
549548#: ../../tutorial/modules.rst:493
550549msgid ""
0 commit comments