@@ -41,8 +41,8 @@ msgid ""
4141" You may also want to use a handy function that you've written in several "
4242"programs without copying its definition into each program."
4343msgstr ""
44- "退出 Python 解释器再次进入时,会丢失之前定义的函数和变量。因此,在编写较长程序时 ,建议用文本编辑器代替解释器,执行文件中的输入内容,这就是编写 "
45- "*脚本* 。随着程序越来越长,为了方便维护,最好把一个脚本拆分成多个文件。还一种情况,是在不同程序中使用同一个函数时,不用每次都要把函数复制到各个程序 。"
44+ "退出 Python 解释器再次进入时,会丢失之前定义的函数和变量。因此,编写较长程序时 ,建议用文本编辑器代替解释器,执行文件中的输入内容,这就是编写 "
45+ "*脚本* 。随着程序越来越长,为了方便维护,最好把一个脚本拆分成多个文件。还一种情况,不同程序使用同一个函数时,不用每次把函数复制到各个程序 。"
4646
4747#: ../../tutorial/modules.rst:16
4848msgid ""
@@ -52,7 +52,7 @@ msgid ""
5252"modules or into the *main* module (the collection of variables that you have"
5353" access to in a script executed at the top level and in calculator mode)."
5454msgstr ""
55- "为实现这些需求,Python 可以把各种定义存入一个文件 ,在脚本或解释器的交互式实例中使用。这个文件就是 *模块* ;模块中的定义可以 *导入* "
55+ "为实现这些需求,Python 把各种定义存入一个文件 ,在脚本或解释器的交互式实例中使用。这个文件就是 *模块* ;模块中的定义可以 *导入* "
5656"到其他模块或 *主* 模块(在顶层和计算器模式下,执行脚本中可访问的变量集)。"
5757
5858#: ../../tutorial/modules.rst:22
@@ -64,7 +64,7 @@ msgid ""
6464"to create a file called :file:`fibo.py` in the current directory with the "
6565"following contents::"
6666msgstr ""
67- "模块是包含 Python 定义和语句的文件。文件名就是模块名加后缀名 :file:`.py` 。在模块内部,通过全局变量 ``__name__`` "
67+ "模块是包含 Python 定义和语句的文件。其文件名是模块名加后缀名 :file:`.py` 。在模块内部,通过全局变量 ``__name__`` "
6868"可以获取模块名(即字符串)。例如,用文本编辑器在当前目录下创建 :file:`fibo.py` 文件,输入以下内容:"
6969
7070#: ../../tutorial/modules.rst:45
@@ -78,7 +78,7 @@ msgid ""
7878"This does not enter the names of the functions defined in ``fibo`` directly"
7979" in the current symbol table; it only enters the module name ``fibo`` there."
8080" Using the module name you can access the functions::"
81- msgstr "这项操作不会把 ``fibo`` 函数定义的名称直接导入到当前符号表 ,只导入模块名 ``fibo`` 。需要使用模块名访问函数 :"
81+ msgstr "这项操作不直接把 ``fibo`` 函数定义的名称导入到当前符号表 ,只导入模块名 ``fibo`` 。要使用模块名访问函数 :"
8282
8383#: ../../tutorial/modules.rst:61
8484msgid ""
@@ -108,7 +108,7 @@ msgid ""
108108" know what you are doing you can touch a module's global variables with the "
109109"same notation used to refer to its functions, ``modname.itemname``."
110110msgstr ""
111- "每个模块都有自己的私有符号表,也就是模块中所有函数的全局符号表 。因此,在模块内使用全局变量时,不用担心与用户定义的全局变量发生冲突。另一方面,可以用访问模块内函数一样的标记法 ,访问模块的全局变量,``modname.itemname``。"
111+ "模块有自己的私有符号表,用作模块中所有函数的全局符号表 。因此,在模块内使用全局变量时,不用担心与用户定义的全局变量发生冲突。另一方面,可以用与访问模块函数一样的标记法 ,访问模块的全局变量,``modname.itemname``。"
112112
113113#: ../../tutorial/modules.rst:85
114114msgid ""
@@ -135,7 +135,7 @@ msgstr "这段代码不会把模块名导入到局部符号表里(因此,本
135135
136136#: ../../tutorial/modules.rst:100
137137msgid "There is even a variant to import all names that a module defines::"
138- msgstr "还有一种变体还可以导入模块内定义的所有名称 :"
138+ msgstr "还有一种变体可以导入模块内定义的所有名称 :"
139139
140140#: ../../tutorial/modules.rst:106
141141msgid ""
@@ -144,21 +144,21 @@ msgid ""
144144"an unknown set of names into the interpreter, possibly hiding some things "
145145"you have already defined."
146146msgstr ""
147- "这种方式会导入所有不以下划线(``_``)开头的名称。大多数情况下,不要用这个功能,这种方式向解释器引入了一堆未知名称 ,可能会覆盖已经定义的名称。"
147+ "这种方式会导入所有不以下划线(``_``)开头的名称。大多数情况下,不要用这个功能,这种方式向解释器导入了一批未知的名称 ,可能会覆盖已经定义的名称。"
148148
149149#: ../../tutorial/modules.rst:111
150150msgid ""
151151"Note that in general the practice of importing ``*`` from a module or "
152152"package is frowned upon, since it often causes poorly readable code. "
153153"However, it is okay to use it to save typing in interactive sessions."
154154msgstr ""
155- "注意,一般情况下,不建议从模块或包内导入 ``*``, 因为,这项操作常让代码变得难以理解 。不过,为了在交互式编译器中少打几个字,这么用也没问题。 "
155+ "注意,一般情况下,不建议从模块或包内导入 ``*``, 因为,这项操作经常让代码变得难以理解 。不过,为了在交互式编译器中少打几个字,这么用也没问题。 "
156156
157157#: ../../tutorial/modules.rst:115
158158msgid ""
159159"If the module name is followed by :keyword:`!as`, then the name following "
160160":keyword:`!as` is bound directly to the imported module."
161- msgstr "模块名后使用 :keyword:`!as` 时,:keyword:`!as` 之后的名称直接与导入模块绑定 。"
161+ msgstr "模块名后使用 :keyword:`!as` 时,直接把 :keyword:`!as` 后的名称与导入模块绑定 。"
162162
163163#: ../../tutorial/modules.rst:124
164164msgid ""
@@ -179,13 +179,13 @@ msgid ""
179179"use :func:`importlib.reload`, e.g. ``import importlib; "
180180"importlib.reload(modulename)``."
181181msgstr ""
182- "为了保证效率,模块在每次解释器会话中只导入一次。如果更改了模块,必须要重启解释器 ;仅交互测试一个模块时,也可以使用 "
182+ "为了保证运行效率,每次解释器会话只导入一次模块。如果更改了模块内容,必须重启解释器 ;仅交互测试一个模块时,也可以使用 "
183183":func:`importlib.reload`,例如 ``import importlib; "
184184"importlib.reload(modulename)``。"
185185
186186#: ../../tutorial/modules.rst:146
187187msgid "Executing modules as scripts"
188- msgstr "以脚本的方式执行模块 "
188+ msgstr "以脚本方式执行模块 "
189189
190190#: ../../tutorial/modules.rst:148
191191msgid "When you run a Python module with ::"
@@ -228,8 +228,8 @@ msgid ""
228228"file named :file:`spam.py` in a list of directories given by the variable "
229229":data:`sys.path`. :data:`sys.path` is initialized from these locations:"
230230msgstr ""
231- "导入 :mod:`spam` 的模块时 ,解释器首先查找名为 `spam` 的内置模块。如果没找到,解释器再从 :data:`sys.path` "
232- "变量中的目录列表里寻找 :file:`spam.py` 文件。:data:`sys.path` 初始化时包含以下位置:"
231+ "导入 :mod:`spam` 模块时 ,解释器首先查找名为 `spam` 的内置模块。如果没找到,解释器再从 :data:`sys.path` "
232+ "变量中的目录列表里查找 :file:`spam.py` 文件。:data:`sys.path` 初始化时包含以下位置:"
233233
234234#: ../../tutorial/modules.rst:190
235235msgid ""
@@ -254,7 +254,7 @@ msgid ""
254254"directory containing the symlink is **not** added to the module search path."
255255msgstr ""
256256"在支持 symlink 的文件系统中,输入脚本目录是在追加 symlink 后计算出来的。换句话说,包含 symlink 的目录并 **没有** "
257- "添加到模块搜索路径上 。 "
257+ "添加至模块搜索路径 。 "
258258
259259#: ../../tutorial/modules.rst:201
260260msgid ""
@@ -286,8 +286,9 @@ msgid ""
286286msgstr ""
287287"为了快速加载模块,Python 把模块的编译版缓存在 ``__pycache__`` 目录中,文件名为 "
288288":file:`module.{version}.pyc`,version 对编译文件格式进行编码,一般是 Python 的版本号。例如,CPython "
289- "的 3.3 发行版中,spam.py 的编译版本缓存为 ``__pycache__/spam.cpython-33.pyc``。此命名惯例支持 "
290- "Python 的不同发行版和不同版本的已编译模块共存。"
289+ "的 3.3 发行版中,spam.py 的编译版本缓存为 "
290+ "``__pycache__/spam.cpython-33.pyc``。使用这种此命名惯例,可以实现 Python "
291+ "不同发行版和不同版本的已编译模块共存。"
291292
292293#: ../../tutorial/modules.rst:222
293294msgid ""
@@ -298,7 +299,7 @@ msgid ""
298299"architectures."
299300msgstr ""
300301"Python "
301- "对比编译版本与源码的修改日期,查看它是否已过期,是否要重新编译,此过程完全自动化。此外,编译模块与平台无关,因此,可在不同架构的系统之间共享相同的支持库 。"
302+ "对比编译版本与源码的修改日期,查看它是否已过期,是否要重新编译,此过程完全自动化。此外,编译模块与平台无关,因此,可在不同架构系统之间共享相同的支持库 。"
302303
303304#: ../../tutorial/modules.rst:227
304305msgid ""
@@ -310,8 +311,8 @@ msgid ""
310311" must not be a source module."
311312msgstr ""
312313"Python "
313- "在两种情况下不检查缓存。其一,从命令行直接载入的模块,只是重新编译,且不存储编译结果 ;其二,没有源模块,就不会检查缓存。为了支持无源文件(仅编译)发行版本,"
314- " 编译模块必须在源目录下,并且绝不能有源模块。"
314+ "在两种情况下不检查缓存。其一,从命令行直接载入模块,只重新编译,不存储编译结果 ;其二,没有源模块,就不会检查缓存。为了支持无源文件(仅编译)发行版本, "
315+ "编译模块必须在源目录下,并且绝不能有源模块。"
315316
316317#: ../../tutorial/modules.rst:234
317318msgid "Some tips for experts:"
@@ -327,7 +328,7 @@ msgid ""
327328"have an ``opt-`` tag and are usually smaller. Future releases may change "
328329"the effects of optimization."
329330msgstr ""
330- "在 Python 命令中使用 :option:`-O` 或 :option:`-OO` 开关, 可以减小编译模块的大小。 ``-O`` "
331+ "在 Python 命令中使用 :option:`-O` 或 :option:`-OO` 开关,可以减小编译模块的大小。``-O`` "
331332"去除断言语句,``-OO`` 去除断言语句和 __doc__ "
332333"字符串。有些程序可能依赖于这些内容,因此,没有十足的把握,不要使用这两个选项。“优化过的”模块带有 ``opt-`` "
333334"标签,并且文件通常会一小些。将来的发行版或许会改进优化的效果。"
@@ -337,7 +338,7 @@ msgid ""
337338"A program doesn't run any faster when it is read from a ``.pyc`` file than "
338339"when it is read from a ``.py`` file; the only thing that's faster about "
339340"``.pyc`` files is the speed with which they are loaded."
340- msgstr "从 ``.pyc`` 文件读取的程序不比从 ``.py`` 读取执行速度快 ,``.pyc`` 文件只是加载速度更快。"
341+ msgstr "从 ``.pyc`` 文件读取的程序不比从 ``.py`` 读取的执行速度快 ,``.pyc`` 文件只是加载速度更快。"
341342
342343#: ../../tutorial/modules.rst:248
343344msgid ""
@@ -349,7 +350,7 @@ msgstr ":mod:`compileall` 模块可以为一个目录下的所有模块创建 .p
349350msgid ""
350351"There is more detail on this process, including a flow chart of the "
351352"decisions, in :pep:`3147`."
352- msgstr ":pep:`3147` 说明了有关这一过程的更多细节,还包括一个决策流程图 。"
353+ msgstr "本过程的细节及决策流程图,详见 :pep:`3147`。"
353354
354355#: ../../tutorial/modules.rst:258
355356msgid "Standard Modules"
@@ -399,7 +400,7 @@ msgstr ":func:`dir` 函数"
399400msgid ""
400401"The built-in function :func:`dir` is used to find out which names a module "
401402"defines. It returns a sorted list of strings::"
402- msgstr "内置函数 :func:`dir` 用于查找模块定义的名称。返回经过排序的字符串列表 :"
403+ msgstr "内置函数 :func:`dir` 用于查找模块定义的名称。返回结果是经过排序的字符串列表 :"
403404
404405#: ../../tutorial/modules.rst:331
405406msgid ""
0 commit comments