@@ -186,15 +186,15 @@ msgid ""
186186"Note that this creates (or overwrites) a variable named ``x`` that still "
187187"exists after the loop completes. We can calculate the list of squares "
188188"without any side effects using::"
189- msgstr ""
189+ msgstr "注意这里创建(或被重写)的名为 ``x`` 的变量在for循环后仍然存在。我们可以计算squares的值而不会产生任何副作用 :: "
190190
191191#: ../../tutorial/datastructures.rst:212
192192msgid "or, equivalently::"
193- msgstr ""
193+ msgstr "或者,等价于 :: "
194194
195195#: ../../tutorial/datastructures.rst:216
196196msgid "which is more concise and readable."
197- msgstr ""
197+ msgstr "上面这种写法更加简洁易读 "
198198
199199#: ../../tutorial/datastructures.rst:218
200200msgid ""
@@ -205,27 +205,30 @@ msgid ""
205205":keyword:`if` clauses which follow it. For example, this listcomp combines "
206206"the elements of two lists if they are not equal::"
207207msgstr ""
208+ "列表推导式由一对方括号包含着以下内容构成:一个表达式,后面跟着一个 :keyword:`for` 从句,再然后是0或多个 :keyword:`for` "
209+ "或 :keyword:`if` 从句。其结果将会是一个新列表,由表达式依据其后面的 :keyword:`for` 和 :keyword:`if` "
210+ "从句计算得出的结果来构成。举例来说,如下列表推导式结合两个列表中的不相等的元素 ::"
208211
209212#: ../../tutorial/datastructures.rst:228
210213msgid "and it's equivalent to::"
211- msgstr ""
214+ msgstr "而这等价于 :: "
212215
213216#: ../../tutorial/datastructures.rst:239
214217msgid ""
215218"Note how the order of the :keyword:`for` and :keyword:`if` statements is the"
216219" same in both these snippets."
217- msgstr ""
220+ msgstr "注意在上面两个代码片段中, :keyword:`for` 和 :keyword:`if` 的顺序是相同的。 "
218221
219222#: ../../tutorial/datastructures.rst:242
220223msgid ""
221224"If the expression is a tuple (e.g. the ``(x, y)`` in the previous example), "
222225"it must be parenthesized. ::"
223- msgstr ""
226+ msgstr "如果表达式是一个元组(例如上面的 ``(x, y)``),那么就必须加上括号 :: "
224227
225228#: ../../tutorial/datastructures.rst:273
226229msgid ""
227230"List comprehensions can contain complex expressions and nested functions::"
228- msgstr ""
231+ msgstr "列表推导可以使用复杂的表达式和嵌套函数 :: "
229232
230233#: ../../tutorial/datastructures.rst:280
231234msgid "Nested List Comprehensions"
@@ -235,40 +238,40 @@ msgstr "嵌套的列表推导式"
235238msgid ""
236239"The initial expression in a list comprehension can be any arbitrary "
237240"expression, including another list comprehension."
238- msgstr ""
241+ msgstr "列表推导式中的初始表达式可以是任何表达式,包括另一个列表推导式。 "
239242
240243#: ../../tutorial/datastructures.rst:285
241244msgid ""
242245"Consider the following example of a 3x4 matrix implemented as a list of 3 "
243246"lists of length 4::"
244- msgstr ""
247+ msgstr "考虑下面这个 3x4的矩阵,它由3个长度为4的列表组成 :: "
245248
246249#: ../../tutorial/datastructures.rst:294
247250msgid "The following list comprehension will transpose rows and columns::"
248- msgstr ""
251+ msgstr "下面的列表推导式将交换其行和列 :: "
249252
250253#: ../../tutorial/datastructures.rst:299
251254msgid ""
252255"As we saw in the previous section, the nested listcomp is evaluated in the "
253256"context of the :keyword:`for` that follows it, so this example is equivalent"
254257" to::"
255- msgstr ""
258+ msgstr "如上所示,嵌套的列表推导式计算的是 :keyword:`for` 和 :keyword:`if` 后的内容,所以这个例子等价于 :: "
256259
257260#: ../../tutorial/datastructures.rst:310
258261msgid "which, in turn, is the same as::"
259- msgstr ""
262+ msgstr "反过来说,也等价于 :: "
260263
261264#: ../../tutorial/datastructures.rst:323
262265msgid ""
263266"In the real world, you should prefer built-in functions to complex flow "
264267"statements. The :func:`zip` function would do a great job for this use "
265268"case::"
266- msgstr ""
269+ msgstr "实际应用中,你应该会更喜欢使用内置函数去组成复杂的流程语句。 :func:`zip` 函数将会很好地处理这种情况 :: "
267270
268271#: ../../tutorial/datastructures.rst:329
269272msgid ""
270273"See :ref:`tut-unpacking-arguments` for details on the asterisk in this line."
271- msgstr ""
274+ msgstr "关于本行中星号的详细说明,参见 :ref:`tut-unpacking-arguments`。 "
272275
273276#: ../../tutorial/datastructures.rst:334
274277msgid "The :keyword:`del` statement"
@@ -282,16 +285,18 @@ msgid ""
282285" to remove slices from a list or clear the entire list (which we did earlier"
283286" by assignment of an empty list to the slice). For example::"
284287msgstr ""
288+ "有一种方法可以从列表中按照给定的索引而不是值来删除一个元素: :keyword:`del` 语句。它不同于有返回值的 :meth:`pop` 方法。 "
289+ ":keyword:`del` 语句也可以从列表中删除一个切片,或清空整个列表(我们之前的方式是把空列表赋值给列表切片)。例如 ::"
285290
286291#: ../../tutorial/datastructures.rst:353
287292msgid ":keyword:`del` can also be used to delete entire variables::"
288- msgstr ""
293+ msgstr ":keyword:`del` 也可以被用来删除整个变量 :: "
289294
290295#: ../../tutorial/datastructures.rst:357
291296msgid ""
292297"Referencing the name ``a`` hereafter is an error (at least until another "
293298"value is assigned to it). We'll find other uses for :keyword:`del` later."
294- msgstr ""
299+ msgstr "此后再引用 ``a`` 时会报错(直到另一个值被赋给它)。我们会在后面了解到 :keyword:`del` 的其他用法。 "
295300
296301#: ../../tutorial/datastructures.rst:364
297302msgid "Tuples and Sequences"
@@ -305,6 +310,8 @@ msgid ""
305310"data types may be added. There is also another standard sequence data type:"
306311" the *tuple*."
307312msgstr ""
313+ "我们看到列表和字符串有很多共同特性,例如索引和切片操作。他们是 *序列* 数据类型(参见 "
314+ ":ref:`typeseeq`)中的两种。随着Python语言的发展,其他的序列类型也会被加入其中。这里介绍另一种标准序列类型:*元组*。"
308315
309316#: ../../tutorial/datastructures.rst:372
310317msgid ""
0 commit comments