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

Skip to content

Commit 64ceea3

Browse files
committed
[po] auto sync bot
1 parent 26999e3 commit 64ceea3

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

faq/library.po

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,16 @@ msgid ""
238238
"avoid depending on mutating global variables, since this makes testing much "
239239
"more difficult to do."
240240
msgstr ""
241+
"为了使测试更容易,你应该在程序中使用良好的模块化设计。程序中的绝大多数功能都应该用函数或类方法封装 —— "
242+
"有时这样做会有额外惊喜,程序会运行得更快(因为局部变量比全局变量访问要快)。除此之外,程序应该避免依赖可变的局部变量,这会使得测试困难许多。"
241243

242244
#: ../../faq/library.rst:155
243245
msgid "The \"global main logic\" of your program may be as simple as ::"
244-
msgstr ""
246+
msgstr "程序的“全局主逻辑”应该尽量简单:"
245247

246248
#: ../../faq/library.rst:160
247249
msgid "at the bottom of the main module of your program."
248-
msgstr ""
250+
msgstr "并放置在程序主模块的最后面。"
249251

250252
#: ../../faq/library.rst:162
251253
msgid ""
@@ -258,23 +260,27 @@ msgid ""
258260
"the \"production code\", since this makes it easy to find bugs and even "
259261
"design flaws earlier."
260262
msgstr ""
263+
"一旦你的程序已经用函数和类完善地组织起来,你就应该编写测试函数来测试其行为。可以使用自动执行一系列测试函数的测试集与每个模块进行关联。听起来似乎需要大量的工作,但是因为"
264+
" Python "
265+
"非常简洁和灵活,所以实际上会相当简单。在编写“生产代码”的同时别忘了也要编写测试函数,你会发现编程会变得更愉快、更有趣,因为这样会使得发现 bug "
266+
"和设计缺陷更加容易。"
261267

262268
#: ../../faq/library.rst:170
263269
msgid ""
264270
"\"Support modules\" that are not intended to be the main module of a program"
265271
" may include a self-test of the module. ::"
266-
msgstr ""
272+
msgstr "程序主模块之外的其他“辅助模块”中可以增加自测试的入口。"
267273

268274
#: ../../faq/library.rst:176
269275
msgid ""
270276
"Even programs that interact with complex external interfaces may be tested "
271277
"when the external interfaces are unavailable by using \"fake\" interfaces "
272278
"implemented in Python."
273-
msgstr ""
279+
msgstr "通过使用 Python 实现的“假”接口,即使是需要与复杂的外部接口交互的程序也可以在外部接口不可用时进行测试。"
274280

275281
#: ../../faq/library.rst:182
276282
msgid "How do I create documentation from doc strings?"
277-
msgstr ""
283+
msgstr "怎样用 docstring 创建文档?"
278284

279285
#: ../../faq/library.rst:184
280286
msgid ""
@@ -283,41 +289,47 @@ msgid ""
283289
"docstrings is `epydoc <http://epydoc.sourceforge.net/>`_. `Sphinx <http"
284290
"://sphinx-doc.org>`_ can also include docstring content."
285291
msgstr ""
292+
":mod:`pydoc` 模块可以用 Python 源码中的 docstring 创建 HTML 文件。也可以使用 `epydoc "
293+
"<http://epydoc.sourceforge.net/>`_ 来只通过 docstring 创建 API 文档。`Sphinx <http"
294+
"://sphinx-doc.org>`_ 也可以引入 docstring 的内容。"
286295

287296
#: ../../faq/library.rst:191
288297
msgid "How do I get a single keypress at a time?"
289-
msgstr ""
298+
msgstr "怎样一次只获取一个按键?"
290299

291300
#: ../../faq/library.rst:193
292301
msgid ""
293302
"For Unix variants there are several solutions. It's straightforward to do "
294303
"this using curses, but curses is a fairly large module to learn."
295-
msgstr ""
304+
msgstr "在类 Unix 系统中有多种方案。最直接的方法是使用 curses,但是 curses 模块太大了,难以学习。"
296305

297306
#: ../../faq/library.rst:237
298307
msgid "Threads"
299-
msgstr ""
308+
msgstr "线程相关"
300309

301310
#: ../../faq/library.rst:240
302311
msgid "How do I program using threads?"
303-
msgstr ""
312+
msgstr "程序中怎样使用线程?"
304313

305314
#: ../../faq/library.rst:242
306315
msgid ""
307316
"Be sure to use the :mod:`threading` module and not the :mod:`_thread` "
308317
"module. The :mod:`threading` module builds convenient abstractions on top of"
309318
" the low-level primitives provided by the :mod:`_thread` module."
310319
msgstr ""
320+
"一定要使用 :mod:`threading` 模块,不要使用 :mod:`_thread` 模块。:mod:`threading` 模块对 "
321+
":mod:`_thread` 模块提供的底层线程原语做了更易用的抽象。"
311322

312323
#: ../../faq/library.rst:246
313324
msgid ""
314325
"Aahz has a set of slides from his threading tutorial that are helpful; see "
315326
"http://www.pythoncraft.com/OSCON2001/."
316327
msgstr ""
328+
"Aahz 的非常实用的 threading 教程中有一些幻灯片;可以参阅 http://www.pythoncraft.com/OSCON2001/ 。"
317329

318330
#: ../../faq/library.rst:251
319331
msgid "None of my threads seem to run: why?"
320-
msgstr ""
332+
msgstr "我的线程都没有运行,为什么?"
321333

322334
#: ../../faq/library.rst:253
323335
msgid ""

tutorial/datastructures.po

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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
192192
msgid "or, equivalently::"
193-
msgstr ""
193+
msgstr "或者,等价于 ::"
194194

195195
#: ../../tutorial/datastructures.rst:216
196196
msgid "which is more concise and readable."
197-
msgstr ""
197+
msgstr "上面这种写法更加简洁易读"
198198

199199
#: ../../tutorial/datastructures.rst:218
200200
msgid ""
@@ -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::"
207207
msgstr ""
208+
"列表推导式由一对方括号包含着以下内容构成:一个表达式,后面跟着一个 :keyword:`for` 从句,再然后是0或多个 :keyword:`for` "
209+
"或 :keyword:`if` 从句。其结果将会是一个新列表,由表达式依据其后面的 :keyword:`for` 和 :keyword:`if` "
210+
"从句计算得出的结果来构成。举例来说,如下列表推导式结合两个列表中的不相等的元素 ::"
208211

209212
#: ../../tutorial/datastructures.rst:228
210213
msgid "and it's equivalent to::"
211-
msgstr ""
214+
msgstr "而这等价于 ::"
212215

213216
#: ../../tutorial/datastructures.rst:239
214217
msgid ""
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
220223
msgid ""
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
226229
msgid ""
227230
"List comprehensions can contain complex expressions and nested functions::"
228-
msgstr ""
231+
msgstr "列表推导可以使用复杂的表达式和嵌套函数 ::"
229232

230233
#: ../../tutorial/datastructures.rst:280
231234
msgid "Nested List Comprehensions"
@@ -235,40 +238,40 @@ msgstr "嵌套的列表推导式"
235238
msgid ""
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
241244
msgid ""
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
247250
msgid "The following list comprehension will transpose rows and columns::"
248-
msgstr ""
251+
msgstr "下面的列表推导式将交换其行和列 ::"
249252

250253
#: ../../tutorial/datastructures.rst:299
251254
msgid ""
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
258261
msgid "which, in turn, is the same as::"
259-
msgstr ""
262+
msgstr "反过来说,也等价于 ::"
260263

261264
#: ../../tutorial/datastructures.rst:323
262265
msgid ""
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
269272
msgid ""
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
274277
msgid "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::"
284287
msgstr ""
288+
"有一种方法可以从列表中按照给定的索引而不是值来删除一个元素: :keyword:`del` 语句。它不同于有返回值的 :meth:`pop` 方法。 "
289+
":keyword:`del` 语句也可以从列表中删除一个切片,或清空整个列表(我们之前的方式是把空列表赋值给列表切片)。例如 ::"
285290

286291
#: ../../tutorial/datastructures.rst:353
287292
msgid ":keyword:`del` can also be used to delete entire variables::"
288-
msgstr ""
293+
msgstr ":keyword:`del` 也可以被用来删除整个变量 ::"
289294

290295
#: ../../tutorial/datastructures.rst:357
291296
msgid ""
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
297302
msgid "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*."
307312
msgstr ""
313+
"我们看到列表和字符串有很多共同特性,例如索引和切片操作。他们是 *序列* 数据类型(参见 "
314+
":ref:`typeseeq`)中的两种。随着Python语言的发展,其他的序列类型也会被加入其中。这里介绍另一种标准序列类型:*元组*。"
308315

309316
#: ../../tutorial/datastructures.rst:372
310317
msgid ""

0 commit comments

Comments
 (0)