@@ -302,6 +302,8 @@ msgid ""
302
302
"there is only one built-in integral type, named :class:`int`; but it behaves"
303
303
" mostly like the old :class:`!long` type."
304
304
msgstr ""
305
+ ":pep:`237`: 在实质上,:class:`!long` 已改名为 :class:`int`。 也就是说,只存在一种内置整数类型,即 "
306
+ ":class:`int`;但其行为与旧的 :class:`!long` 类型极其相似。"
305
307
306
308
#: ../../whatsnew/3.0.rst:213
307
309
msgid ""
@@ -321,6 +323,9 @@ msgid ""
321
323
":data:`!sys.maxint` in previous releases on the same platform (assuming the "
322
324
"same build options)."
323
325
msgstr ""
326
+ ":data:`!sys.maxint` 常量已被移除,因为整数的值不再有任何限制。 不过,:data:`sys.maxsize` "
327
+ "也可被用作大于任何实际列表或字符串索引的整数。 它与具体实现的“自然”整数大小保持一致并且通常与同一平台上之前发布版中的 "
328
+ ":data:`!sys.maxint` 相同(假定使用相同的构建选项)。"
324
329
325
330
#: ../../whatsnew/3.0.rst:224
326
331
msgid ""
@@ -358,6 +363,12 @@ msgid ""
358
363
":exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-"
359
364
"specific behavior has caused numerous sad faces over the years."
360
365
msgstr ""
366
+ "Python 3.0 使用 *文本* 和 (二进制) *数据* 等概念来替代 Unicode 字符串和 8 位字符串。 所有文本均使用 "
367
+ "Unicode;不过 *已编码* Unicode 是以二进制数据来表示的。 用于存放文本的类型是 :class:`str`,用于存放数据的类型是 "
368
+ ":class:`bytes`。 与 2.x 场景的最大区别是在 Python 3.0 中任何混用文本和数据的尝试都将引发 "
369
+ ":exc:`TypeError`,而当你在 Python 2.x 中混用 Unicode 和 8 位字符串时,如果 8 位字符串恰好仅包含 7 位 "
370
+ "(ASCII) 字节数据那就没有问题,但是如果包含非 ASCII 值则将引发 :exc:`UnicodeDecodeError`。 "
371
+ "这种依赖于特定值的行为多年来造成了无数的苦恼。"
361
372
362
373
#: ../../whatsnew/3.0.rst:250
363
374
msgid ""
@@ -369,6 +380,9 @@ msgid ""
369
380
":class:`str` for binary or encoded data only. Then the ``2to3`` tool will "
370
381
"do most of the work for you."
371
382
msgstr ""
383
+ "作为此项设计哲学方面的修改造成的影响,几乎所有使用 Unicode、编码格式或二进制数据的代码都很有可能必须被修改。 这项改变是有益的,因为在 2.x "
384
+ "世界中存在着无数涉及混用已编码和未编码文本的程序缺陷。 要在 Python 2.x 中做好准备,请使用 :class:`!unicode` "
385
+ "表示所有未编码文本,只对二进制或已编码数据使用 :class:`str`。 这样 ``2to3`` 工具将为你完成大部分工作。"
372
386
373
387
#: ../../whatsnew/3.0.rst:258
374
388
msgid ""
@@ -384,6 +398,10 @@ msgid ""
384
398
":class:`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)``"
385
399
" and ``str(b, encoding=...)``, respectively."
386
400
msgstr ""
401
+ "由于 :class:`str` 和 :class:`bytes` 类型无法混用,你必须始终在它们之间执行显式转换。 使用 "
402
+ ":meth:`str.encode` 将 :class:`str` 转为 :class:`bytes`,并使用 :meth:`bytes.decode`"
403
+ " 将 :class:`bytes` 转为 :class:`str`。 你也可以分别使用 ``bytes(s, encoding=...)`` 和 "
404
+ "``str(b, encoding=...)``。"
387
405
388
406
#: ../../whatsnew/3.0.rst:268
389
407
msgid ""
0 commit comments