@@ -1082,6 +1082,8 @@ msgid ""
1082
1082
"This is consistent with Python 2.2, where :class:`int`, :class:`str`, etc., "
1083
1083
"underwent the same change."
1084
1084
msgstr ""
1085
+ "从这个例子中还可以看到,内置的 :class:`slice` 对象现在是 slice 类型的类型对象,而不再是函数。 这与 Python 2.2 "
1086
+ "是一致的,在 Python 2.2 中,:class:`int`,:class:`str` 等也经历了同样的变化。"
1085
1087
1086
1088
#: ../../whatsnew/2.3.rst:966
1087
1089
msgid "Other Language Changes"
@@ -1122,12 +1124,14 @@ msgid ""
1122
1124
"that ``isinstance(int(expression), int)`` is false, but that seems unlikely "
1123
1125
"to cause problems in practice."
1124
1126
msgstr ""
1127
+ ":func:`int` 类型构造函数现在会返回一个长整数,而不会在字符串或浮点数太大而无法放入整数时引发 :exc:`OverflowError`。 "
1128
+ "这可能会导致 ``isinstance(int(expression), int)`` 为假的矛盾结果,但在实践中似乎不太可能造成问题。"
1125
1129
1126
1130
#: ../../whatsnew/2.3.rst:986
1127
1131
msgid ""
1128
1132
"Built-in types now support the extended slicing syntax, as described in "
1129
1133
"section :ref:`section-slices` of this document."
1130
- msgstr ""
1134
+ msgstr "内置类型现在支持扩展的切分语法,详见本文档 :ref:`section-slices` 一节。 "
1131
1135
1132
1136
#: ../../whatsnew/2.3.rst:989
1133
1137
msgid ""
@@ -1144,13 +1148,17 @@ msgid ""
1144
1148
"consistent with slice indexing, so when *pos* is -1 the value will be "
1145
1149
"inserted before the last element, and so forth."
1146
1150
msgstr ""
1151
+ "以前 ``list.insert(pos, value)`` 在 *pos* 为负值时会将 *value* 插入到列表的前面。 "
1152
+ "现在,该行为已被修改为与切片索引一致,因此当 *pos* 为 -1 时,值将被插入最后一个元素之前,以此类推。"
1147
1153
1148
1154
#: ../../whatsnew/2.3.rst:999
1149
1155
msgid ""
1150
1156
"``list.index(value)``, which searches for *value* within the list and "
1151
1157
"returns its index, now takes optional *start* and *stop* arguments to limit"
1152
1158
" the search to only part of the list."
1153
1159
msgstr ""
1160
+ "``list.index(value)`` 会在列表中搜索 *value*,并返回其索引,现在可以使用可选的 *start* 和 *stop* "
1161
+ "参数,将搜索范围限制在列表的一部分。"
1154
1162
1155
1163
#: ../../whatsnew/2.3.rst:1003
1156
1164
msgid ""
@@ -1159,13 +1167,18 @@ msgid ""
1159
1167
"dictionary. If the requested key isn't present in the dictionary, *default*"
1160
1168
" is returned if it's specified and :exc:`KeyError` raised if it isn't. ::"
1161
1169
msgstr ""
1170
+ "字典有一个新方法 ``pop(key[, *default*])``,可返回 *key* "
1171
+ "对应的值,并从字典中删除该键/值对。如果请求的键不在字典中,如果指定了 *default*,则返回 *default*,如果没有指定则会引发 "
1172
+ ":exc:`KeyError`。 ::"
1162
1173
1163
1174
#: ../../whatsnew/2.3.rst:1025
1164
1175
msgid ""
1165
1176
"There's also a new class method, ``dict.fromkeys(iterable, value)``, that "
1166
1177
"creates a dictionary with keys taken from the supplied iterator *iterable* "
1167
1178
"and all values set to *value*, defaulting to ``None``."
1168
1179
msgstr ""
1180
+ "还有一个新的类方法 ``dict.fromkeys(iterable, value)``,用于创建一个字典,其键取自所提供的迭代器 "
1181
+ "*iterable*,所有值设置为 *value*,默认为 ``None``。"
1169
1182
1170
1183
#: ../../whatsnew/2.3.rst:1029
1171
1184
msgid "(Patches contributed by Raymond Hettinger.)"
@@ -1209,13 +1222,18 @@ msgid ""
1209
1222
":option:`-Walways::PendingDeprecationWarning:: <-W>` on the command line or "
1210
1223
"use :func:`warnings.filterwarnings`."
1211
1224
msgstr ""
1225
+ "添加了一个新的警告 :exc:`PendingDeprecationWarning`,用于指示正在被废弃的功能。 默认情况下 *不会* 打印该警告。 "
1226
+ "要检查是否使用了将来会被废弃的功能,可在命令行中提供 :option:`-Walways::PendingDeprecationWarning:: "
1227
+ "<-W>` 或使用 :func:`warnings.filterwarnings`。"
1212
1228
1213
1229
#: ../../whatsnew/2.3.rst:1065
1214
1230
msgid ""
1215
1231
"The process of deprecating string-based exceptions, as in ``raise \" Error "
1216
1232
"occurred\" ``, has begun. Raising a string will now trigger "
1217
1233
":exc:`PendingDeprecationWarning`."
1218
1234
msgstr ""
1235
+ "与 ``raise \" Error occurred\" `` 一样,基于字符串的异常的废弃过程已经开始。 现在,引发字符串异常将触发 "
1236
+ ":exc:`PendingDeprecationWarning`。"
1219
1237
1220
1238
#: ../../whatsnew/2.3.rst:1069
1221
1239
msgid ""
@@ -1288,6 +1306,9 @@ msgid ""
1288
1306
"lines of those relating to assigning to an instance's "
1289
1307
":attr:`~instance.__class__` attribute."
1290
1308
msgstr ""
1309
+ "旧式和新式类之间的不兼容问题之一已被消除:您现在可以为新式类的 :attr:`~definition.__name__` 和 "
1310
+ ":attr:`~class.__bases__` 属性赋值。 对 :attr:`~class.__bases__` 的赋值有一些限制,与对实例的 "
1311
+ ":attr:`~instance.__class__` 属性的赋值类似。"
1291
1312
1292
1313
#: ../../whatsnew/2.3.rst:1125
1293
1314
msgid "String Changes"
@@ -1301,6 +1322,9 @@ msgid ""
1301
1322
"and ``X in Y`` will return :const:`True` if *X* is a substring of *Y*. If "
1302
1323
"*X* is the empty string, the result is always :const:`True`. ::"
1303
1324
msgstr ""
1325
+ ":keyword:`in` 运算符现在对字符串的作用不同了。 以前,当计算 ``X in Y`` 时,*X* 和 *Y* 都是字符串,*X* "
1326
+ "只能是单字符。 现在情况有所改变;*X* 可以是任意长度的字符串,如果 *X* 是 *Y* 的子串,``X in Y`` 将返回 "
1327
+ ":const:`True`。 如果 *X* 是空字符串,结果总是 :const:`True`。 ::"
1304
1328
1305
1329
#: ../../whatsnew/2.3.rst:1140
1306
1330
msgid ""
0 commit comments