@@ -447,6 +447,9 @@ msgid ""
447447"and Windows uses a two-character sequence of a carriage return plus a "
448448"newline."
449449msgstr ""
450+ "目前使用的三大操作系统是微软的 Windows、苹果的 Macintosh OS 和各种 Unix "
451+ "衍生系统。跨平台工作的一个小麻烦是,这三个平台都使用不同的字符来标记文本文件中的行结束。Unix 使用换行符(ASCII 字符 10),MacOS "
452+ "使用回车符(ASCII 字符 13),Windows 使用回车符加换行符的双字符序列。"
450453
451454#: ../../whatsnew/2.3.rst:384
452455msgid ""
@@ -472,6 +475,8 @@ msgid ""
472475":option:`!--without-universal-newlines` switch when running Python's "
473476":program:`configure` script."
474477msgstr ""
478+ "在编译 Python 时,可以通过在运行 Python 的 :program:`configure` 脚本时指定 :option:`!--"
479+ "without-universal-newlines` 开关禁用该功能。"
475480
476481#: ../../whatsnew/2.3.rst:403
477482msgid ":pep:`278` - Universal Newline Support"
@@ -492,6 +497,9 @@ msgid ""
492497"sequence, returns an iterator that will return ``(0, thing[0])``, ``(1, "
493498"thing[1])``, ``(2, thing[2])``, and so forth."
494499msgstr ""
500+ "新的内置函数 :func:`enumerate` 将使某些循环更加清晰。 在 ``enumerate(thing)`` 中,如果 *thing* "
501+ "是迭代器或序列,则返回一个迭代器,该迭代器将返回 ``(0, thing[0])``,``(1, thing[1])``,``(2, "
502+ "thing[2])``,以此类推。"
495503
496504#: ../../whatsnew/2.3.rst:419
497505msgid "A common idiom to change every element of a list looks like this::"
@@ -524,6 +532,9 @@ msgid ""
524532"log, or even e-mail them to a particular address; of course, it's also "
525533"possible to write your own handler classes."
526534msgstr ""
535+ "Python 2.3 中新增了一个用于编写日志的标准软件包 :mod:`logging`。 "
536+ "它为生成日志输出提供了一个强大而灵活的机制,这些输出可以通过各种方式进行过滤和处理。用标准格式编写的配置文件可以用来控制程序的日志行为。 Python "
537+ "包含的处理器可以将日志记录写入标准错误、文件或套接字,发送到系统日志,甚至通过电子邮件发送到特定地址;当然,您也可以编写自己的处理器类。"
527538
528539#: ../../whatsnew/2.3.rst:453
529540msgid ""
@@ -609,6 +620,8 @@ msgid ""
609620"documentation for all of the details. Reading :pep:`282` will also be "
610621"helpful."
611622msgstr ""
623+ ":mod:`logging` 软件包具有所有这些功能,即使是最复杂的应用程序也能灵活运用。 "
624+ "本文仅是对其功能的不完整概述,因此请参阅软件包的参考文档了解所有细节。 阅读 :pep:`282` 也会有所帮助。"
612625
613626#: ../../whatsnew/2.3.rst:541
614627msgid ":pep:`282` - A Logging System"
@@ -637,12 +650,14 @@ msgid ""
637650"for it takes any Python value and converts it to :const:`True` or "
638651":const:`False`. ::"
639652msgstr ""
653+ "这个新类型的类型对象名为 :class:`bool`;它的构造函数接收任何 Python 值,并将其转换为 :const:`True` 或 "
654+ ":const:`False`。::"
640655
641656#: ../../whatsnew/2.3.rst:570
642657msgid ""
643658"Most of the standard library modules and built-in functions have been "
644659"changed to return Booleans. ::"
645- msgstr ""
660+ msgstr "大多数标准库模块和内置函数都改为返回布尔值: "
646661
647662#: ../../whatsnew/2.3.rst:581
648663msgid ""
@@ -653,6 +668,8 @@ msgid ""
653668"the statement is ``return True``, however, the meaning of the return value "
654669"is quite clear."
655670msgstr ""
671+ "添加 Python 布尔运算的主要目的是使代码更清晰。 例如,如果您在阅读一个函数时遇到 ``return 1`` 语句,您可能会想知道 ``1`` "
672+ "代表的是布尔真值、索引还是乘以其他量的系数。 然而,如果语句是 ``return True``,返回值的含义就非常清楚了。"
656673
657674#: ../../whatsnew/2.3.rst:587
658675msgid ""
@@ -666,6 +683,10 @@ msgid ""
666683" a subclass of the :class:`int` class so that arithmetic using a Boolean "
667684"still works. ::"
668685msgstr ""
686+ "Python 的布尔值 *不是* 为了严格的类型检查而添加的。 像 Pascal 这样非常严格的语言也会阻止您使用布尔进行算术运算,并要求 "
687+ ":keyword:`if` 语句中的表达式总是求布尔结果。 正如 :pep:`285` 所明确指出的,Python 没有这么严格,以后也不会有。 "
688+ "这意味着您仍然可以在 :keyword:`!if` 语句中使用任何表达式,甚至是求值为 list、tuple 或一些随机对象的表达式。 布尔类型是 "
689+ ":class:`int` 类的子类,因此使用布尔值进行算术运算仍然有效:"
669690
670691#: ../../whatsnew/2.3.rst:605
671692msgid ""
@@ -674,6 +695,9 @@ msgid ""
674695"difference that :func:`str` and :func:`repr` return the strings ``'True'`` "
675696"and ``'False'`` instead of ``'1'`` and ``'0'``."
676697msgstr ""
698+ "用一句话概括 :const:`True` 和 :const:`False`: 它们是拼写整数值 1 和 0 的另一种方式,唯一不同的是 "
699+ ":func:`str` 和 :func:`repr` 返回的字符串是 ``'True'`` 和 ``'False'``,而不是 ``'1'`` 和 "
700+ "``'0'``。"
677701
678702#: ../../whatsnew/2.3.rst:613
679703msgid ":pep:`285` - Adding a bool type"
@@ -698,6 +722,9 @@ msgid ""
698722"inserting an XML character reference or HTML entity reference into the "
699723"converted string."
700724msgstr ""
725+ "将 Unicode 字符串编码为字节字符串时,可能会遇到无法编码的字符。 到目前为止,Python 允许将错误处理指定为\" strict\" (引发 "
726+ ":exc:`UnicodeError`)、\" ignore\" (跳过该字符) 或\" replace\" (在输出字符串中使用问号),其中 "
727+ "\" strict\" 是默认行为。 可能需要指定对此类错误的其他处理方式,例如在转换后的字符串中插入 XML 字符引用或 HTML 实体引用。"
701728
702729#: ../../whatsnew/2.3.rst:630
703730msgid ""
@@ -710,13 +737,18 @@ msgid ""
710737"target encoding. The handler can then either raise an exception or return a"
711738" replacement string."
712739msgstr ""
740+ "Python 现在有一个灵活的框架,可以添加不同的处理策略。可以通过 :func:`codecs.register_error` "
741+ "添加新的错误处理器,然后编解码器可以通过 :func:`codecs.lookup_error` 访问错误处理器。 "
742+ "错误处理器会获取必要的状态信息,如正在转换的字符串、字符串中检测到错误的位置以及目标编码。 然后,处理器可以引发异常或返回替换字符串。"
713743
714744#: ../../whatsnew/2.3.rst:638
715745msgid ""
716746"Two additional error handlers have been implemented using this framework: "
717747"\" backslashreplace\" uses Python backslash quoting to represent unencodable "
718748"characters and\" xmlcharrefreplace\" emits XML character references."
719749msgstr ""
750+ "使用该框架还实现了两个额外的错误处理器:\" backslashreplace\" 使用 Python 反斜杠引号来表示无法编码的字符,而 "
751+ "\" xmlcharrefreplace\" 则转换为 XML 字符引用。"
720752
721753#: ../../whatsnew/2.3.rst:645
722754msgid ":pep:`293` - Codec Error Handling Callbacks"
@@ -760,7 +792,7 @@ msgstr ""
760792msgid ""
761793"Here's an example :file:`setup.py` with classifiers, written to be "
762794"compatible with older versions of the Distutils::"
763- msgstr ""
795+ msgstr "下面是一个带有分类器的 :file:`setup.py` 示例,其编写是为了兼容旧版本的 Distutils: "
764796
765797#: ../../whatsnew/2.3.rst:688
766798msgid ""
@@ -805,12 +837,17 @@ msgid ""
805837"an importer object that will handle imports from this path or raises an "
806838":exc:`ImportError` exception if it can't handle this path."
807839msgstr ""
840+ "``sys.path_hooks`` 是一个可调用对象列表,通常是类。 "
841+ "每个可调用对象都接收一个包含路径的字符串,然后返回一个可处理从该路径导入的导入器对象,如果不能处理该路径,则引发 :exc:`ImportError` "
842+ "异常。"
808843
809844#: ../../whatsnew/2.3.rst:721
810845msgid ""
811846"``sys.path_importer_cache`` caches importer objects for each path, so "
812847"``sys.path_hooks`` will only need to be traversed once for each path."
813848msgstr ""
849+ "``sys.path_importer_cache`` 会缓存每条路径的导入器对象,因此 ``sys.path_hooks`` 只需为每条路径遍历一次。"
850+ " "
814851
815852#: ../../whatsnew/2.3.rst:724
816853msgid ""
@@ -819,6 +856,8 @@ msgid ""
819856" can add objects to it. Additional built-in and frozen modules can be "
820857"imported by an object added to this list."
821858msgstr ""
859+ "``sys.meta_path`` 是一个导入器对象列表,在检查 ``sys.path`` 之前将遍历该列表。 "
860+ "该列表最初为空,但用户代码可以向其中添加对象。 其他内置模块和冻结模块可以通过添加到该列表中的对象导入。"
822861
823862#: ../../whatsnew/2.3.rst:729
824863msgid ""
@@ -833,7 +872,7 @@ msgstr ""
833872msgid ""
834873"Pseudo-code for Python's new import logic, therefore, looks something like "
835874"this (simplified a bit; see :pep:`302` for the full details)::"
836- msgstr ""
875+ msgstr "因此,Python 新导入逻辑的伪代码如下 (略有简化;详情请参见 :pep:`302`): "
837876
838877#: ../../whatsnew/2.3.rst:760
839878msgid ":pep:`302` - New Import Hooks"
@@ -869,7 +908,7 @@ msgstr "读取一行并调用 ``line.split(',')``: 再简单不过了吧? 但
869908msgid ""
870909"A big ugly regular expression can parse this, but using the new :mod:`csv` "
871910"package is much simpler::"
872- msgstr ""
911+ msgstr "一个大的丑陋的正则表达式可以解析这些内容,但使用新的 :mod:`csv` 软件包要简单得多: "
873912
874913#: ../../whatsnew/2.3.rst:793
875914msgid ""
@@ -920,6 +959,9 @@ msgid ""
920959"format. A new constant, :const:`pickle.HIGHEST_PROTOCOL`, can be used to "
921960"select the fanciest protocol available."
922961msgstr ""
962+ "解决办法就是发明一种新的 pickle 协议。 :func:`pickle.dumps` 函数很早就支持文本或二进制标志。 在 2.3 "
963+ "中,该标志从布尔值重新定义为整数:0 表示旧的文本模式 pickle 格式,1 表示旧的二进制格式,现在 2 表示新的 2.3 专用格式。 一个新常量 "
964+ ":const:`pickle.HIGHEST_PROTOCOL` 可用来选择最先进的协议。"
923965
924966#: ../../whatsnew/2.3.rst:830
925967msgid ""
@@ -945,6 +987,8 @@ msgid ""
945987"Software Foundation will maintain a list of standardized codes; there's also"
946988" a range of codes for private use. Currently no codes have been specified."
947989msgstr ""
990+ "为了进一步压缩 pickle 类,现在可以使用整数代码而不是长字符串来标识 pickle 类。 Python "
991+ "软件基金会将维护一个标准化代码列表;还有一系列供私人使用的代码。 目前还没有指定任何代码。"
948992
949993#: ../../whatsnew/2.3.rst:849
950994msgid ":pep:`307` - Extensions to the pickle protocol"
@@ -969,21 +1013,26 @@ msgid ""
9691013" if you tried it. Michael Hudson contributed a patch to fix this "
9701014"shortcoming."
9711015msgstr ""
1016+ "从 Python 1.4 开始,切片语法支持可选的第三个“step”或“stride”参数。例如,这些都是合法的 Python 语法: "
1017+ "``L[1:10:2]``,``L[:-1:1]``,``L[::-1]``。 这是应 Numerical Python 开发者的要求添加到 "
1018+ "Python 中的,因为 Numerical Python 广泛使用第三个参数。 然而,Python 内置的 list、tuple "
1019+ "和字符串序列类型从未支持过这一特性,如果您尝试使用,会引发 :exc:`TypeError`。 Michael Hudson "
1020+ "提供了一个补丁来修复这一缺陷。"
9721021
9731022#: ../../whatsnew/2.3.rst:868
9741023msgid ""
9751024"For example, you can now easily extract the elements of a list that have "
9761025"even indexes::"
977- msgstr ""
1026+ msgstr "例如,您现在可以轻松地提取出具有偶数索引的列表元素: "
9781027
9791028#: ../../whatsnew/2.3.rst:875
9801029msgid ""
9811030"Negative values also work to make a copy of the same list in reverse order::"
982- msgstr ""
1031+ msgstr "也可以用负值以按相反顺序复制相同的列表: "
9831032
9841033#: ../../whatsnew/2.3.rst:880
9851034msgid "This also works for tuples, arrays, and strings::"
986- msgstr ""
1035+ msgstr "这也适用于元组、数组和字符串: "
9871036
9881037#: ../../whatsnew/2.3.rst:888
9891038msgid ""
@@ -992,17 +1041,18 @@ msgid ""
9921041"assignment to extended and regular slices. Assignment to a regular slice "
9931042"can be used to change the length of the sequence::"
9941043msgstr ""
1044+ "如果你有一个可变序列如列表或数组,你可以对扩展切片进行赋值或删除,但对扩展切片的赋值与对常规切片的赋值有一些区别。对常规片段的赋值可以用来改变序列的长度:"
9951045
9961046#: ../../whatsnew/2.3.rst:900
9971047msgid ""
9981048"Extended slices aren't this flexible. When assigning to an extended slice, "
9991049"the list on the right hand side of the statement must contain the same "
10001050"number of items as the slice it is replacing::"
1001- msgstr ""
1051+ msgstr "扩展分片则没有这种灵活性。 在为扩展分片赋值时,语句右侧的列表必须包含与要替换的分片相同数量的项目: "
10021052
10031053#: ../../whatsnew/2.3.rst:917
10041054msgid "Deletion is more straightforward::"
1005- msgstr ""
1055+ msgstr "删除操作更为直观: "
10061056
10071057#: ../../whatsnew/2.3.rst:928
10081058msgid ""
@@ -1012,7 +1062,7 @@ msgstr ""
10121062
10131063#: ../../whatsnew/2.3.rst:934
10141064msgid "Or use slice objects directly in subscripts::"
1015- msgstr ""
1065+ msgstr "或者直接在下标中使用切片对象: "
10161066
10171067#: ../../whatsnew/2.3.rst:939
10181068msgid ""