@@ -2706,6 +2706,8 @@ msgid ""
27062706" that is unless the call failed, in which case the *error_callback* is "
27072707"applied instead."
27082708msgstr ""
2709+ "如果指定了 *callback* , 它必须是一个接受单个参数的可调用对象。当执行成功时, *callback* "
2710+ "会被用于处理执行后的返回结果,否则,调用 *error_callback* 。"
27092711
27102712#: ../../library/multiprocessing.rst:2162
27112713#: ../../library/multiprocessing.rst:2191
@@ -2714,48 +2716,54 @@ msgid ""
27142716"a single argument. If the target function fails, then the *error_callback* "
27152717"is called with the exception instance."
27162718msgstr ""
2719+ "如果指定了 *error_callback* , 它必须是一个接受单个参数的可调用对象。当目标函数执行失败时, 会将抛出的异常对象作为参数传递给 "
2720+ "*error_callback* 执行。"
27172721
27182722#: ../../library/multiprocessing.rst:2166
27192723#: ../../library/multiprocessing.rst:2195
27202724msgid ""
27212725"Callbacks should complete immediately since otherwise the thread which "
27222726"handles the results will get blocked."
2723- msgstr ""
2727+ msgstr "回调函数应该立即执行完成,否则会阻塞负责处理结果的线程。 "
27242728
27252729#: ../../library/multiprocessing.rst:2171
27262730msgid ""
27272731"A parallel equivalent of the :func:`map` built-in function (it supports only"
27282732" one *iterable* argument though). It blocks until the result is ready."
2729- msgstr ""
2733+ msgstr "内置 :func:`map` 函数(它只支持一个 *可迭代* 参数)的并行版本,它会阻塞直到返回结果。 "
27302734
27312735#: ../../library/multiprocessing.rst:2174
27322736msgid ""
27332737"This method chops the iterable into a number of chunks which it submits to "
27342738"the process pool as separate tasks. The (approximate) size of these chunks "
27352739"can be specified by setting *chunksize* to a positive integer."
2736- msgstr ""
2740+ msgstr "这个方法会将可迭代对象分割为许多块,然后提交给进程池。可以将 *chunksize* 设置为一个正整数从而(近似)指定每个块的大小可以。 "
27372741
27382742#: ../../library/multiprocessing.rst:2178
27392743msgid ""
27402744"Note that it may cause high memory usage for very long iterables. Consider "
27412745"using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* "
27422746"option for better efficiency."
27432747msgstr ""
2748+ "注意对于很长的迭代对象,可能消耗很多内存。可以考虑使用 :meth:`imap` 或 :meth:`imap_unordered` 并且显示指定 "
2749+ "*chunksize* 以提升效率。"
27442750
27452751#: ../../library/multiprocessing.rst:2184
27462752msgid "A variant of the :meth:`.map` method which returns a result object."
2747- msgstr ""
2753+ msgstr "和 :meth:`.map` 方法类似,但是返回一个可用于获取结果的对象。 "
27482754
27492755#: ../../library/multiprocessing.rst:2200
27502756msgid "A lazier version of :meth:`.map`."
2751- msgstr ""
2757+ msgstr ":meth:`.map` 的延迟执行版本。 "
27522758
27532759#: ../../library/multiprocessing.rst:2202
27542760msgid ""
27552761"The *chunksize* argument is the same as the one used by the :meth:`.map` "
27562762"method. For very long iterables using a large value for *chunksize* can "
27572763"make the job complete **much** faster than using the default value of ``1``."
27582764msgstr ""
2765+ "*chunksize* 参数的作用和 :meth:`.map` 方法的一样。对于很长的迭代器,给 *chunksize* 设置一个很大的值会比默认值 "
2766+ "``1`` **极大** 地加快执行速度。"
27592767
27602768#: ../../library/multiprocessing.rst:2207
27612769msgid ""
@@ -2764,64 +2772,73 @@ msgid ""
27642772"``next(timeout)`` will raise :exc:`multiprocessing.TimeoutError` if the "
27652773"result cannot be returned within *timeout* seconds."
27662774msgstr ""
2775+ "同样,如果 *chunksize* 是 ``1`` , 那么 :meth:`imap` 方法所返回的迭代器的 :meth:`!next` "
2776+ "方法拥有一个可选的 *timeout* 参数: 如果无法在 *timeout* 秒内执行得到结果,则``next(timeout)`` 会抛出 "
2777+ ":exc:`multiprocessing.TimeoutError` 异常。"
27672778
27682779#: ../../library/multiprocessing.rst:2214
27692780msgid ""
27702781"The same as :meth:`imap` except that the ordering of the results from the "
27712782"returned iterator should be considered arbitrary. (Only when there is only "
27722783"one worker process is the order guaranteed to be \" correct\" .)"
27732784msgstr ""
2785+ "和 :meth:`imap` 相同,只不过通过迭代器返回的结果是任意的。(当进程池中只有一个工作进程的时候,返回结果的顺序才能认为是\" 有序\" 的)"
27742786
27752787#: ../../library/multiprocessing.rst:2220
27762788msgid ""
27772789"Like :meth:`map` except that the elements of the *iterable* are expected to "
27782790"be iterables that are unpacked as arguments."
2779- msgstr ""
2791+ msgstr "和 :meth:`map` 类似,不过 *iterable* 中的每一项会被解包再作为函数参数。 "
27802792
27812793#: ../../library/multiprocessing.rst:2223
27822794msgid ""
27832795"Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), "
27842796"func(3,4)]``."
2785- msgstr ""
2797+ msgstr "比如可迭代对象 ``[(1,2), (3, 4)]`` 会转化为等价于 ``[func(1,2), func(3,4)]`` 的调用。 "
27862798
27872799#: ../../library/multiprocessing.rst:2230
27882800msgid ""
27892801"A combination of :meth:`starmap` and :meth:`map_async` that iterates over "
27902802"*iterable* of iterables and calls *func* with the iterables unpacked. "
27912803"Returns a result object."
27922804msgstr ""
2805+ "相当于 :meth:`starmap` 与 :meth:`map_async` 的结合,迭代 *iterable* 的每一项,解包作为 *func* "
2806+ "的参数并执行,返回用于获取结果的对象。"
27932807
27942808#: ../../library/multiprocessing.rst:2238
27952809msgid ""
27962810"Prevents any more tasks from being submitted to the pool. Once all the "
27972811"tasks have been completed the worker processes will exit."
2798- msgstr ""
2812+ msgstr "阻止后续任务提交到进程池,当所有任务执行完成后,工作进程会退出。 "
27992813
28002814#: ../../library/multiprocessing.rst:2243
28012815msgid ""
28022816"Stops the worker processes immediately without completing outstanding work."
28032817" When the pool object is garbage collected :meth:`terminate` will be called"
28042818" immediately."
2805- msgstr ""
2819+ msgstr "不必等待未完成的任务,立即停止工作进程。当进程池对象呗垃圾回收时, 会立即调用 :meth:`terminate` 。 "
28062820
28072821#: ../../library/multiprocessing.rst:2249
28082822msgid ""
28092823"Wait for the worker processes to exit. One must call :meth:`close` or "
28102824":meth:`terminate` before using :meth:`join`."
2811- msgstr ""
2825+ msgstr "等待工作进程结束。调用 :meth:`join` 前必须先调用 :meth:`close` 或者 :meth:`terminate` 。 "
28122826
28132827#: ../../library/multiprocessing.rst:2252
28142828msgid ""
28152829"Pool objects now support the context management protocol -- see "
28162830":ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the "
28172831"pool object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`."
28182832msgstr ""
2833+ "进程池对象现在支持上下文管理器协议 - 参见 :ref:`typecontextmanager` "
2834+ "。:meth:`~contextmanager.__enter__` 返回进程池对象, :meth:`~contextmanager.__exit__`"
2835+ " 会调用 :meth:`terminate` 。"
28192836
28202837#: ../../library/multiprocessing.rst:2260
28212838msgid ""
28222839"The class of the result returned by :meth:`Pool.apply_async` and "
28232840":meth:`Pool.map_async`."
2824- msgstr ""
2841+ msgstr ":meth:`Pool.apply_async` 和 :meth:`Pool.map_async` 返回对象所属的类。 "
28252842
28262843#: ../../library/multiprocessing.rst:2265
28272844msgid ""
@@ -2830,14 +2847,16 @@ msgid ""
28302847":exc:`multiprocessing.TimeoutError` is raised. If the remote call raised an"
28312848" exception then that exception will be reraised by :meth:`get`."
28322849msgstr ""
2850+ "用于获取执行结果。如果 *timeout* 不是 ``None`` 并且在 *timeout* 秒内仍然没有执行完得到结果,则抛出 "
2851+ ":exc:`multiprocessing.TimeoutError` 异常。如果远程调用发生异常,这个异常会通过 :meth:`get` 重新抛出。"
28332852
28342853#: ../../library/multiprocessing.rst:2272
28352854msgid "Wait until the result is available or until *timeout* seconds pass."
2836- msgstr ""
2855+ msgstr "阻塞,直到返回结果,或者 *timeout* 秒后超时。 "
28372856
28382857#: ../../library/multiprocessing.rst:2276
28392858msgid "Return whether the call has completed."
2840- msgstr ""
2859+ msgstr "返回执行状态,是否已经完成。 "
28412860
28422861#: ../../library/multiprocessing.rst:2280
28432862msgid ""
0 commit comments