@@ -1082,6 +1082,8 @@ msgid ""
10821082"This is consistent with Python 2.2, where :class:`int`, :class:`str`, etc., "
10831083"underwent the same change."
10841084msgstr ""
1085+ "从这个例子中还可以看到,内置的 :class:`slice` 对象现在是 slice 类型的类型对象,而不再是函数。 这与 Python 2.2 "
1086+ "是一致的,在 Python 2.2 中,:class:`int`,:class:`str` 等也经历了同样的变化。"
10851087
10861088#: ../../whatsnew/2.3.rst:966
10871089msgid "Other Language Changes"
@@ -1122,12 +1124,14 @@ msgid ""
11221124"that ``isinstance(int(expression), int)`` is false, but that seems unlikely "
11231125"to cause problems in practice."
11241126msgstr ""
1127+ ":func:`int` 类型构造函数现在会返回一个长整数,而不会在字符串或浮点数太大而无法放入整数时引发 :exc:`OverflowError`。 "
1128+ "这可能会导致 ``isinstance(int(expression), int)`` 为假的矛盾结果,但在实践中似乎不太可能造成问题。"
11251129
11261130#: ../../whatsnew/2.3.rst:986
11271131msgid ""
11281132"Built-in types now support the extended slicing syntax, as described in "
11291133"section :ref:`section-slices` of this document."
1130- msgstr ""
1134+ msgstr "内置类型现在支持扩展的切分语法,详见本文档 :ref:`section-slices` 一节。 "
11311135
11321136#: ../../whatsnew/2.3.rst:989
11331137msgid ""
@@ -1144,13 +1148,17 @@ msgid ""
11441148"consistent with slice indexing, so when *pos* is -1 the value will be "
11451149"inserted before the last element, and so forth."
11461150msgstr ""
1151+ "以前 ``list.insert(pos, value)`` 在 *pos* 为负值时会将 *value* 插入到列表的前面。 "
1152+ "现在,该行为已被修改为与切片索引一致,因此当 *pos* 为 -1 时,值将被插入最后一个元素之前,以此类推。"
11471153
11481154#: ../../whatsnew/2.3.rst:999
11491155msgid ""
11501156"``list.index(value)``, which searches for *value* within the list and "
11511157"returns its index, now takes optional *start* and *stop* arguments to limit"
11521158" the search to only part of the list."
11531159msgstr ""
1160+ "``list.index(value)`` 会在列表中搜索 *value*,并返回其索引,现在可以使用可选的 *start* 和 *stop* "
1161+ "参数,将搜索范围限制在列表的一部分。"
11541162
11551163#: ../../whatsnew/2.3.rst:1003
11561164msgid ""
@@ -1159,13 +1167,18 @@ msgid ""
11591167"dictionary. If the requested key isn't present in the dictionary, *default*"
11601168" is returned if it's specified and :exc:`KeyError` raised if it isn't. ::"
11611169msgstr ""
1170+ "字典有一个新方法 ``pop(key[, *default*])``,可返回 *key* "
1171+ "对应的值,并从字典中删除该键/值对。如果请求的键不在字典中,如果指定了 *default*,则返回 *default*,如果没有指定则会引发 "
1172+ ":exc:`KeyError`。 ::"
11621173
11631174#: ../../whatsnew/2.3.rst:1025
11641175msgid ""
11651176"There's also a new class method, ``dict.fromkeys(iterable, value)``, that "
11661177"creates a dictionary with keys taken from the supplied iterator *iterable* "
11671178"and all values set to *value*, defaulting to ``None``."
11681179msgstr ""
1180+ "还有一个新的类方法 ``dict.fromkeys(iterable, value)``,用于创建一个字典,其键取自所提供的迭代器 "
1181+ "*iterable*,所有值设置为 *value*,默认为 ``None``。"
11691182
11701183#: ../../whatsnew/2.3.rst:1029
11711184msgid "(Patches contributed by Raymond Hettinger.)"
@@ -1209,13 +1222,18 @@ msgid ""
12091222":option:`-Walways::PendingDeprecationWarning:: <-W>` on the command line or "
12101223"use :func:`warnings.filterwarnings`."
12111224msgstr ""
1225+ "添加了一个新的警告 :exc:`PendingDeprecationWarning`,用于指示正在被废弃的功能。 默认情况下 *不会* 打印该警告。 "
1226+ "要检查是否使用了将来会被废弃的功能,可在命令行中提供 :option:`-Walways::PendingDeprecationWarning:: "
1227+ "<-W>` 或使用 :func:`warnings.filterwarnings`。"
12121228
12131229#: ../../whatsnew/2.3.rst:1065
12141230msgid ""
12151231"The process of deprecating string-based exceptions, as in ``raise \" Error "
12161232"occurred\" ``, has begun. Raising a string will now trigger "
12171233":exc:`PendingDeprecationWarning`."
12181234msgstr ""
1235+ "与 ``raise \" Error occurred\" `` 一样,基于字符串的异常的废弃过程已经开始。 现在,引发字符串异常将触发 "
1236+ ":exc:`PendingDeprecationWarning`。"
12191237
12201238#: ../../whatsnew/2.3.rst:1069
12211239msgid ""
@@ -1288,6 +1306,9 @@ msgid ""
12881306"lines of those relating to assigning to an instance's "
12891307":attr:`~instance.__class__` attribute."
12901308msgstr ""
1309+ "旧式和新式类之间的不兼容问题之一已被消除:您现在可以为新式类的 :attr:`~definition.__name__` 和 "
1310+ ":attr:`~class.__bases__` 属性赋值。 对 :attr:`~class.__bases__` 的赋值有一些限制,与对实例的 "
1311+ ":attr:`~instance.__class__` 属性的赋值类似。"
12911312
12921313#: ../../whatsnew/2.3.rst:1125
12931314msgid "String Changes"
@@ -1301,6 +1322,9 @@ msgid ""
13011322"and ``X in Y`` will return :const:`True` if *X* is a substring of *Y*. If "
13021323"*X* is the empty string, the result is always :const:`True`. ::"
13031324msgstr ""
1325+ ":keyword:`in` 运算符现在对字符串的作用不同了。 以前,当计算 ``X in Y`` 时,*X* 和 *Y* 都是字符串,*X* "
1326+ "只能是单字符。 现在情况有所改变;*X* 可以是任意长度的字符串,如果 *X* 是 *Y* 的子串,``X in Y`` 将返回 "
1327+ ":const:`True`。 如果 *X* 是空字符串,结果总是 :const:`True`。 ::"
13041328
13051329#: ../../whatsnew/2.3.rst:1140
13061330msgid ""
0 commit comments