Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e761e0

Browse files
committed
[po] auto sync bot
1 parent d2e8d76 commit 1e761e0

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

faq/programming.po

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# Zhe He <[email protected]>, 2019
1212
# ChenYuan <[email protected]>, 2019
1313
# Siyuan Xu <[email protected]>, 2019
14-
# Meng Du <[email protected]>, 2019
1514
# ppcfish <[email protected]>, 2019
15+
# Meng Du <[email protected]>, 2019
1616
#
1717
#, fuzzy
1818
msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121
"Report-Msgid-Bugs-To: \n"
2222
"POT-Creation-Date: 2019-05-14 11:26+0900\n"
2323
"PO-Revision-Date: 2017-02-16 17:43+0000\n"
24-
"Last-Translator: ppcfish <ppcfish@gmail.com>, 2019\n"
24+
"Last-Translator: Meng Du <alphanow@gmail.com>, 2019\n"
2525
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2626
"MIME-Version: 1.0\n"
2727
"Content-Type: text/plain; charset=UTF-8\n"
@@ -310,7 +310,7 @@ msgid ""
310310
"implicitly global. If a variable is assigned a value anywhere within the "
311311
"function's body, it's assumed to be a local unless explicitly declared as "
312312
"global."
313-
msgstr ""
313+
msgstr "在Python中,仅在函数内引用的变量是隐式全局变量。如果在函数体内的任何位置为变量赋值,则除非明确声明为全局,否则将其视为局部值。"
314314

315315
#: ../../faq/programming.rst:201
316316
msgid ""
@@ -322,6 +322,9 @@ msgid ""
322322
"to a component of an imported module. This clutter would defeat the "
323323
"usefulness of the ``global`` declaration for identifying side-effects."
324324
msgstr ""
325+
"虽然起初有点令人惊讶,但片刻考虑就可以解释。一方面,要求 :keyword:`global` "
326+
"表示已分配的变量可以防止意外的副作用。另一方面,如果所有全局引用都需要 ``global`` ,那么你一直都在使用 ``global`` "
327+
"。你必须将对内置函数或导入模块的组件的每个引用声明为全局。这种杂乱会破坏 ``global`` 声明用于识别副作用的有用性。"
325328

326329
#: ../../faq/programming.rst:211
327330
msgid ""
@@ -333,7 +336,7 @@ msgstr "为什么在具有不同值的循环中定义的lambdas都返回相同
333336
msgid ""
334337
"Assume you use a for loop to define a few different lambdas (or even plain "
335338
"functions), e.g.::"
336-
msgstr ""
339+
msgstr "假设你使用for循环来定义几个不同的 lambda (甚至是普通函数),例如:::"
337340

338341
#: ../../faq/programming.rst:220
339342
msgid ""
@@ -342,6 +345,8 @@ msgid ""
342345
"``1``, ``4``, ``9``, and ``16``. However, when you actually try you will "
343346
"see that they all return ``16``::"
344347
msgstr ""
348+
"这给你一个包含5个lambdas的列表,它们计算 ``x**2`` 。你可能会期望,当它们被调用时,它们将分别返回 ``0`` 、 ``1`` 、 "
349+
"``4`` 、 ``9`` 和 ``16`` 。但是,当你真正尝试时,你会看到它们都返回 ``16`` 。::"
345350

346351
#: ../../faq/programming.rst:230
347352
msgid ""
@@ -351,12 +356,15 @@ msgid ""
351356
"the functions now return ``4**2``, i.e. ``16``. You can also verify this by"
352357
" changing the value of ``x`` and see how the results of the lambdas change::"
353358
msgstr ""
359+
"发生这种情况是因为 ``x`` 不是lambdas的内部变量,而是在外部作用域中定义,并且在调用lambda时访问它 - 而不是在定义它时。 "
360+
"在循环结束时, ``x`` 的值是 ``4`` ,所以所有的函数现在返回 ``4**2`` ,即 ``16`` 。你还可以通过更改 ``x`` "
361+
"的值来验证这一点,并查看lambdas的结果如何变化::"
354362

355363
#: ../../faq/programming.rst:240
356364
msgid ""
357365
"In order to avoid this, you need to save the values in variables local to "
358366
"the lambdas, so that they don't rely on the value of the global ``x``::"
359-
msgstr ""
367+
msgstr "为了避免这种情况,你需要将值保存在lambdas的局部变量中,这样它们就不依赖于全局``x`` 的值 ::"
360368

361369
#: ../../faq/programming.rst:247
362370
msgid ""
@@ -366,12 +374,15 @@ msgid ""
366374
" the first lambda, ``1`` in the second, ``2`` in the third, and so on. "
367375
"Therefore each lambda will now return the correct result::"
368376
msgstr ""
377+
"这里, ``n=x`` 在lambda本地创建一个新的变量 ``n`` ,并在定义lambda时计算,使它具有与 ``x`` "
378+
"在循环中该点相同的值。这意味着 ``n`` 的值在第一个lambda中为 ``0`` ,在第二个lambda中为 ``1`` ,在第三个中为 ``2``"
379+
" ,依此类推。因此每个lambda现在将返回正确的结果::"
369380

370381
#: ../../faq/programming.rst:258
371382
msgid ""
372383
"Note that this behaviour is not peculiar to lambdas, but applies to regular "
373384
"functions too."
374-
msgstr ""
385+
msgstr "请注意,这种行为并不是lambda所特有的,但也适用于常规函数。"
375386

376387
#: ../../faq/programming.rst:263
377388
msgid "How do I share global variables across modules?"
@@ -386,6 +397,8 @@ msgid ""
386397
"each module, any changes made to the module object get reflected everywhere."
387398
" For example:"
388399
msgstr ""
400+
"在单个程序中跨模块共享信息的规范方法是创建一个特殊模块(通常称为config或cfg)。只需在应用程序的所有模块中导入配置模块;然后该模块可用作全局名称。因为每个模块只有一个实例,所以对模块对象所做的任何更改都会在任何地方反映出来。"
401+
" 例如:"
389402

390403
#: ../../faq/programming.rst:271
391404
msgid "config.py::"
@@ -403,7 +416,7 @@ msgstr "main.py::"
403416
msgid ""
404417
"Note that using a module is also the basis for implementing the Singleton "
405418
"design pattern, for the same reason."
406-
msgstr ""
419+
msgstr "请注意,出于同样的原因,使用模块也是实现Singleton设计模式的基础。"
407420

408421
#: ../../faq/programming.rst:291
409422
msgid "What are the \"best practices\" for using import in a module?"
@@ -506,14 +519,16 @@ msgstr "为什么对象之间共享默认值?"
506519
msgid ""
507520
"This type of bug commonly bites neophyte programmers. Consider this "
508521
"function::"
509-
msgstr ""
522+
msgstr "这种类型的缺陷通常会惹恼新手程序员。考虑这个函数 ::"
510523

511524
#: ../../faq/programming.rst:350
512525
msgid ""
513526
"The first time you call this function, ``mydict`` contains a single item. "
514527
"The second time, ``mydict`` contains two items because when ``foo()`` begins"
515528
" executing, ``mydict`` starts out with an item already in it."
516529
msgstr ""
530+
"第一次调用此函数时,``mydict`` 包含一个项目。第二次,``mydict``包含两个项目,因为当 ``foo()`` 开始执行时, "
531+
"``mydict`` 已有一个项目。"
517532

518533
#: ../../faq/programming.rst:354
519534
msgid ""

0 commit comments

Comments
 (0)