@@ -158,6 +158,11 @@ msgid ""
158158"notification e-mail messages that are completely unhelpful, so Ka-Ping Yee "
159159"wrote an HTML screen-scraper that sends more useful messages."
160160msgstr ""
161+ "转向使用 SourceForge 的服务显著提高了开发速度。 "
162+ "补丁现在由原提交者以外的人提交、评论、修改,并在不同人员之间来回传递,直到补丁被认为值得检入。 "
163+ "程序错误在一个中心位置被跟踪,并可以分配给特定人员进行修复,我们还可以统计未解决程序错误的数量来衡量进度。 "
164+ "这并不是没有代价的:开发人员现在需要处理更多的电子邮件,关注更多的邮件列表,并且需要为新环境编写专门的工具。 例如,SourceForge "
165+ "发送的默认补丁和错误通知电子邮件完全无用,所以 Ka-Ping Yee 编写了一个 HTML 屏幕抓取器以便发送更有用的信息。"
161166
162167#: ../../whatsnew/2.0.rst:95
163168msgid ""
@@ -209,6 +214,8 @@ msgid ""
209214"decisions that have gone into Python. The PEP author is responsible for "
210215"building consensus within the community and documenting dissenting opinions."
211216msgstr ""
217+ "我们打算将 PEP 作为提出新特性建议、收集社区对特定问题意见以及为必须加入 Python 的设计决策编写文档的首选机制。 PEP "
218+ "的作者有责任在社区内部建立共识,并应将对立的观点也记入文档。"
212219
213220#: ../../whatsnew/2.0.rst:130
214221msgid ""
@@ -231,6 +238,8 @@ msgid ""
231238"instead of the 8-bit number used by ASCII, meaning that 65,536 distinct "
232239"characters can be supported."
233240msgstr ""
241+ "Python 2.0 中最大的新特性是引入了一种新的基本数据类型:Unicode 字符串。 Unicode 使用 16 位二进制数表示字符,而不是 "
242+ "ASCII 所使用的 8 位,这意味着可以支持 65,536 个不同的字符。"
234243
235244#: ../../whatsnew/2.0.rst:148
236245msgid ""
@@ -241,6 +250,9 @@ msgid ""
241250"was written up as :pep:`100`, \" Python Unicode Integration\" . This article "
242251"will simply cover the most significant points about the Unicode interfaces."
243252msgstr ""
253+ "Unicode 支持的最终接口是通过在 python-dev 邮件列表上无数次激烈的讨论达成的,主要由 Marc-André Lemburg 基于 "
254+ "Fredrik Lundh 的 Unicode 字符串类型实现来完成。 详细的接口说明被写成了 :pep:`100` \" Python Unicode "
255+ "Integration\" 。 这篇文章只简单地涵盖关于 Unicode 接口的最重要信息。"
244256
245257#: ../../whatsnew/2.0.rst:155
246258msgid ""
@@ -265,6 +277,11 @@ msgid ""
265277"installation by calling the ``sys.setdefaultencoding(encoding)`` function in"
266278" a customized version of :file:`site.py`."
267279msgstr ""
280+ "Unicode 字符串和常规字符串一样,是一种不可变的序列类型。 它们可以被索引和切片,但不能原地修改。 Unicode 字符串有一个 "
281+ "``encode( [encoding] )`` 方法,该方法返回一个以所需编码格式表示的 8 位字符串。 编码格式通过字符串命名,如 "
282+ "``'ascii'``、``'utf-8'``、``'iso-8859-1'`` 等等。 为实现和注册新的编码格式定义了一个编解码器 "
283+ "API,这些编码格式随后可在整个 Python 程序中使用。 如果未指定编码格式,默认编码格式通常是 7 位 ASCII,不过这可以通过在自定义版本的 "
284+ ":file:`site.py` 模块中调用 ``sys.setdefaultencoding(encoding)`` 函数来更改。"
268285
269286#: ../../whatsnew/2.0.rst:172
270287msgid ""
@@ -302,6 +319,10 @@ msgid ""
302319"errors to be silently ignored and ``'replace'`` uses U+FFFD, the official "
303320"replacement character, in case of any problems."
304321msgstr ""
322+ "函数 ``unicode(string [, encoding] [, errors] )`` 从 8 位字符串创建一个 Unicode 字符串。 "
323+ "``encoding`` 是一个指定使用编码格式的字符串。``errors`` 参数指定如何处理当前编码格式中无效的字符;传入 ``'strict'``"
324+ " 作为参数值会在有任何编码错误时引发异常,而 ``'ignore'`` 会静默忽略错误,``'replace'`` 则在出现问题时使用 U+FFFD "
325+ "即官方的替换字符。"
305326
306327#: ../../whatsnew/2.0.rst:192
307328msgid ""
@@ -311,6 +332,8 @@ msgid ""
311332"some built-ins; if you find a built-in function that accepts strings but "
312333"doesn't accept Unicode strings at all, please report it as a bug.)"
313334msgstr ""
335+ "``exec`` 语句,以及各种内置函数如 ``eval()``,``getattr()`` 和 ``setattr()`` 也会接受 Unicode "
336+ "字符串和普通字符串。 (修复过程中可能会遗漏一些内置函数;如果你发现一个接受字符串但完全不接受 Unicode 字符串的内置函数,请报告此错误。)"
314337
315338#: ../../whatsnew/2.0.rst:198
316339msgid ""
@@ -320,6 +343,10 @@ msgid ""
320343"that it's uppercase. ``unicodedata.bidirectional(u'\\ u0660')`` returns 'AN',"
321344" meaning that U+0660 is an Arabic number."
322345msgstr ""
346+ "一个新的模块 :mod:`unicodedata` 提供了对 Unicode 字符属性的接口。 "
347+ "例如,``unicodedata.category(u'A')`` 返回 2 个字符的字符串 'Lu',其中 'L' 表示这是一个字母,'u' "
348+ "表示这是一个大写字母。 ``unicodedata.bidirectional(u'\\ u0660')`` 返回 'AN',表示 U+0660 "
349+ "是一个阿拉伯数字。"
323350
324351#: ../../whatsnew/2.0.rst:204
325352msgid ""
@@ -329,6 +356,9 @@ msgid ""
329356"4-element tuple: ``(encode_func, decode_func, stream_reader, "
330357"stream_writer)``."
331358msgstr ""
359+ ":mod:`codecs` 模块包含查找现有编码格式和注册新编码格式的函数。 除非你想实现一个新的编码格式,否则你最常使用的是 "
360+ "``codecs.lookup(encoding)`` 函数,它返回一个 4 元素的元组: ``(encode_func, decode_func, "
361+ "stream_reader, stream_writer)``。"
332362
333363#: ../../whatsnew/2.0.rst:209
334364msgid ""
@@ -338,6 +368,8 @@ msgid ""
338368"encoding, and *length* tells you how much of the Unicode string was "
339369"converted."
340370msgstr ""
371+ "*encode_func* 是一个接受 Unicode 字符串的函数,并返回一个 2 元组 ``(string, length)``。 *string*"
372+ " 是一个包含部分(可能是全部) Unicode 字符串转换为指定编码的 8 位字符串,*length* 告诉你转换了多少 Unicode 字符串。"
341373
342374#: ../../whatsnew/2.0.rst:214
343375msgid ""
@@ -346,6 +378,8 @@ msgid ""
346378"Unicode string *ustring* and the integer *length* telling how much of the "
347379"8-bit string was consumed."
348380msgstr ""
381+ "*decode_func* 与 *encode_func* 相反,它接受一个 8 位字符串并返回一个 2 元组 ``(ustring, "
382+ "length)``,其中 *ustring* 是转换得到的 Unicode 字符串,*length* 是一个整数,表示消耗了多少 8 位字符串。"
349383
350384#: ../../whatsnew/2.0.rst:219
351385msgid ""
@@ -367,18 +401,20 @@ msgstr ""
367401msgid ""
368402"For example, the following code writes a Unicode string into a file, "
369403"encoding it as UTF-8::"
370- msgstr ""
404+ msgstr "例如,以下的代码将 Unicode 字符串写入一个 UTF-8 编码的文件:: "
371405
372406#: ../../whatsnew/2.0.rst:243
373407msgid "The following code would then read UTF-8 input from the file::"
374- msgstr ""
408+ msgstr "以下的代码则可以从文件中读取 UTF-8 输入:: "
375409
376410#: ../../whatsnew/2.0.rst:249
377411msgid ""
378412"Unicode-aware regular expressions are available through the :mod:`re` "
379413"module, which has a new underlying implementation called SRE written by "
380414"Fredrik Lundh of Secret Labs AB."
381415msgstr ""
416+ "支持 Unicode 的正则表达式可以通过 :mod:`re` 模块使用,该模块有一个新的底层实现称为 SRE,由 Secret Labs AB 的 "
417+ "Fredrik Lundh 编写。"
382418
383419#: ../../whatsnew/2.0.rst:253
384420msgid ""
@@ -388,6 +424,8 @@ msgid ""
388424"future version of Python may drop support for 8-bit strings and provide only"
389425" Unicode strings."
390426msgstr ""
427+ "添加了一个 ``-U`` 命令行选项,使 Python 编译器将所有字符串字面量解释为 Unicode 字符串字面量。 这用于测试和为你的 Python"
428+ " 代码提供未来保障,因为未来某个版本的 Python 可能会取消对 8 位字符串的支持,只提供 Unicode 字符串。"
391429
392430#: ../../whatsnew/2.0.rst:262
393431msgid "List Comprehensions"
@@ -402,6 +440,9 @@ msgid ""
402440"might want to pull out all the strings containing a given substring, or "
403441"strip off trailing whitespace from each line."
404442msgstr ""
443+ "列表是 Python 中的一种主力数据类型,许多程序在某个时候都会处理列表。 "
444+ "对列表的两种常见操作是遍历它们,并筛选出符合某个条件的元素,或对每个元素应用某个函数。 "
445+ "例如,给定一个字符串列表,你可能想要提取出所有包含特定子字符串的字符串,或去掉每行的尾随空白。"
405446
406447#: ../../whatsnew/2.0.rst:271
407448msgid ""
@@ -414,17 +455,23 @@ msgid ""
414455"paragraph, finding all the strings in the list containing a given substring."
415456" You could write the following to do it::"
416457msgstr ""
458+ "现有的 :func:`map` 和 :func:`filter` 函数可以用于此目的,但它们需要一个函数作为参数之一。 "
459+ "如果有一个现有的内置函数可以直接传递,这是很好的,但如果没有,你必须创建一个小函数来完成所需的工作。 而 Python "
460+ "的作用域规则会使结果变得丑陋,特别是如果这个小函数需要额外的信息。 以上一段中的第一个例子为例,找到列表中所有包含给定子字符串的字符串。 "
461+ "你可以写如下代码来实现::"
417462
418463#: ../../whatsnew/2.0.rst:286
419464msgid ""
420465"Because of Python's scoping rules, a default argument is used so that the "
421466"anonymous function created by the :keyword:`lambda` expression knows what "
422467"substring is being searched for. List comprehensions make this cleaner::"
423468msgstr ""
469+ "由于 Python 的作用域规则,将会使用默认参数以使由 :keyword:`lambda` 表达式创建的匿名函数知道正在搜索哪个子字符串。 "
470+ "列表推导能使这个过程更简洁::"
424471
425472#: ../../whatsnew/2.0.rst:292
426473msgid "List comprehensions have the form::"
427- msgstr ""
474+ msgstr "列表推导式的形式如下:: "
428475
429476#: ../../whatsnew/2.0.rst:299
430477msgid ""
@@ -436,12 +483,15 @@ msgid ""
436483":keyword:`!if` clause is optional; if present, *expression* is only "
437484"evaluated and added to the result if *condition* is true."
438485msgstr ""
486+ ":keyword:`!for`...:keyword:`!in` 子句包含要迭代的序列。 这些序列不必具有相同的长度,因为它们 *不是* "
487+ "并行迭代的,而是从左到右依次迭代;这一点将在以下段落中更清楚地解释。 生成列表的元素将是 *表达式* 的连续值。 最后的 :keyword:`!if` "
488+ "子句是可选的;如果存在,只有当 *condition* 为真时,*表达式* 才会被求值并添加到结果中。"
439489
440490#: ../../whatsnew/2.0.rst:307
441491msgid ""
442492"To make the semantics very clear, a list comprehension is equivalent to the "
443493"following Python code::"
444- msgstr ""
494+ msgstr "为了使语义更为清晰,列表推导相当于以下 Python 代码:: "
445495
446496#: ../../whatsnew/2.0.rst:319
447497msgid ""
@@ -450,13 +500,17 @@ msgid ""
450500"all the sequences. If you have two lists of length 3, the output list is 9 "
451501"elements long::"
452502msgstr ""
503+ "这意味着当有多个 :keyword:`!for`...:keyword:`!in` 子句时,生成的列表将等于所有序列长的的乘积。 如果你有两个长度为 3"
504+ " 的列表,输出列表将有 9 个元素::"
453505
454506#: ../../whatsnew/2.0.rst:330
455507msgid ""
456508"To avoid introducing an ambiguity into Python's grammar, if *expression* is "
457509"creating a tuple, it must be surrounded with parentheses. The first list "
458510"comprehension below is a syntax error, while the second one is correct::"
459511msgstr ""
512+ "为了避免在 Python 的语法中引入歧义,如果 *表达式* 创建的是一个元组,它必须用括号括起来。 "
513+ "下面的第一个列表推导式有语法错误,而第二个则是正确的::"
460514
461515#: ../../whatsnew/2.0.rst:339
462516msgid ""
@@ -466,10 +520,13 @@ msgid ""
466520"comprehension patch, which was then discussed for a seemingly endless time "
467521"on the python-dev mailing list and kept up-to-date by Skip Montanaro."
468522msgstr ""
523+ "列表推导的概念最初来自函数式编程语言 Haskell (https://www.haskell.org)。 Greg Ewing "
524+ "最有力地提出了将其添加到 Python 中的建议,并编写了最初的列表推导式补丁,然后在 python-dev 邮件列表上进行了看似无休止的讨论,并由 "
525+ "Skip Montanaro 保持更新。"
469526
470527#: ../../whatsnew/2.0.rst:349
471528msgid "Augmented Assignment"
472- msgstr ""
529+ msgstr "增强赋值 "
473530
474531#: ../../whatsnew/2.0.rst:351
475532msgid ""
@@ -479,6 +536,8 @@ msgid ""
479536" value of the variable ``a`` by 2, equivalent to the slightly lengthier ``a"
480537" = a + 2``."
481538msgstr ""
539+ "增强赋值运算符,另一个长期以来要求添加的功能,已经被加入到 Python 2.0 中。 增强赋值运算符包括 ``+=``,``-=``,``*=`` "
540+ "等。例如,语句 ``a += 2`` 将变量 ``a`` 的值增加 2,等同于稍长一些的 ``a = a + 2``。"
482541
483542#: ../../whatsnew/2.0.rst:356
484543msgid ""
0 commit comments