@@ -1569,50 +1569,51 @@ msgstr ""
15691569msgid ""
15701570"The suggested approach is to create a list of the desired length first and "
15711571"then fill in each element with a newly created list::"
1572- msgstr ""
1572+ msgstr "建议的做法是先创建一个所需长度的列表,然后其中的元素再以一个新创建的列表来填充:: "
15731573
15741574#: ../../faq/programming.rst:1253
15751575msgid ""
15761576"This generates a list containing 3 different lists of length two. You can "
15771577"also use a list comprehension::"
1578- msgstr ""
1578+ msgstr "这样就生成了一个包含 3 个长度为二的不同列表的列表。 你也可以使用列表推导式:: "
15791579
15801580#: ../../faq/programming.rst:1259
15811581msgid ""
15821582"Or, you can use an extension that provides a matrix datatype; `NumPy "
15831583"<http://www.numpy.org/>`_ is the best known."
1584- msgstr ""
1584+ msgstr "或者你还可以使用提供矩阵类型的扩展包;其中最著名的是 `NumPy <http://www.numpy.org/>`_。 "
15851585
15861586#: ../../faq/programming.rst:1264
15871587msgid "How do I apply a method to a sequence of objects?"
15881588msgstr "如何将方法应用于一系列对象?"
15891589
15901590#: ../../faq/programming.rst:1266
15911591msgid "Use a list comprehension::"
1592- msgstr "使用列表理解 :"
1592+ msgstr "可以使用列表推导式 :"
15931593
15941594#: ../../faq/programming.rst:1273
15951595msgid ""
15961596"Why does a_tuple[i] += ['item'] raise an exception when the addition works?"
1597- msgstr "为什么在添加 _tuple [i]+=[‘ item’] 时引发异常 ?"
1597+ msgstr "为什么 a_tuple [i] += [' item'] 会在执行加法时引发异常 ?"
15981598
15991599#: ../../faq/programming.rst:1275
16001600msgid ""
16011601"This is because of a combination of the fact that augmented assignment "
16021602"operators are *assignment* operators, and the difference between mutable and"
16031603" immutable objects in Python."
1604- msgstr ""
1604+ msgstr "这是由两个事实共同导致的结果,一是增强赋值运算符属于 *赋值* 运算符,二是在 Python 中存在可变和不可变两种不同的对象。 "
16051605
16061606#: ../../faq/programming.rst:1279
16071607msgid ""
16081608"This discussion applies in general when augmented assignment operators are "
16091609"applied to elements of a tuple that point to mutable objects, but we'll use "
16101610"a ``list`` and ``+=`` as our exemplar."
16111611msgstr ""
1612+ "此处的讨论在任何对元组中指向可变对象的元素使用增强赋值运算符的情况都是普遍成立的,但在此我们只以 ``list`` 和 ``+=`` 来举例。"
16121613
16131614#: ../../faq/programming.rst:1283
16141615msgid "If you wrote::"
1615- msgstr "如果你写成: "
1616+ msgstr "如果你写成这样:: "
16161617
16171618#: ../../faq/programming.rst:1291
16181619msgid ""
@@ -1622,28 +1623,30 @@ msgid ""
16221623"to element ``0`` of the tuple, we get an error because we can't change what "
16231624"an element of a tuple points to."
16241625msgstr ""
1626+ "发生异常的原因是显而易见的: ``1`` 会与对象 ``a_tuple[0]`` 相加,而该对象为 (``1``),得到结果对象 "
1627+ "``2``,但当我们试图将运算结果 ``2`` 赋值给元组的 ``0`` 号元素时就将报错,因为我们不能改变元组的元素所指向的对象。"
16251628
16261629#: ../../faq/programming.rst:1297
16271630msgid ""
16281631"Under the covers, what this augmented assignment statement is doing is "
16291632"approximately this::"
1630- msgstr ""
1633+ msgstr "在表层之处,以上增强赋值语句所做的大致是这样:: "
16311634
16321635#: ../../faq/programming.rst:1306
16331636msgid ""
16341637"It is the assignment part of the operation that produces the error, since a "
16351638"tuple is immutable."
1636- msgstr "由于元组是不可变的,因此操作的赋值部分会产生错误 。"
1639+ msgstr "由于元组是不可变的,因此操作的赋值部分会引发错误 。"
16371640
16381641#: ../../faq/programming.rst:1309
16391642msgid "When you write something like::"
1640- msgstr ""
1643+ msgstr "当你这样写的时候:: "
16411644
16421645#: ../../faq/programming.rst:1317
16431646msgid ""
16441647"The exception is a bit more surprising, and even more surprising is the fact"
16451648" that even though there was an error, the append worked::"
1646- msgstr ""
1649+ msgstr "发生异常会令人略感吃惊,还有一个更为令人吃惊的事实:虽然有报错,但是添加操作却生效了:: "
16471650
16481651#: ../../faq/programming.rst:1323
16491652msgid ""
0 commit comments