@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version :Python 3.11\n "
1313"Report-Msgid-Bugs-To :\n "
14- "POT-Creation-Date :2025-01-31 15:27 +0000\n "
14+ "POT-Creation-Date :2025-05-02 15:33 +0000\n "
1515"PO-Revision-Date :2023-05-24 02:23+0000\n "
1616"Last-Translator :Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
1717"Language-Team :Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -317,6 +317,12 @@ msgid ""
317317":exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-"
318318"specific behavior has caused numerous sad faces over the years."
319319msgstr ""
320+ "Python 3.0 使用 *文本* 和 (二进制) *数据* 等概念来替代 Unicode 字符串和 8 位字符串。 所有文本均使用 "
321+ "Unicode;不过 *已编码* Unicode 是以二进制数据来表示的。 用于存放文本的类型是 :class:`str`,用于存放数据的类型是 "
322+ ":class:`bytes`。 与 2.x 场景的最大区别是在 Python 3.0 中任何混用文本和数据的尝试都将引发 "
323+ ":exc:`TypeError`,而当你在 Python 2.x 中混用 Unicode 和 8 位字符串时,如果 8 位字符串恰好仅包含 7 位 "
324+ "(ASCII) 字节数据那就没有问题,但是如果包含非 ASCII 值则将引发 :exc:`UnicodeDecodeError`。 "
325+ "这种依赖于特定值的行为多年来造成了无数的苦恼。"
320326
321327#: ../../whatsnew/3.0.rst:250
322328msgid ""
@@ -343,6 +349,10 @@ msgid ""
343349":class:`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)``"
344350" and ``str(b, encoding=...)``, respectively."
345351msgstr ""
352+ "由于 :class:`str` 和 :class:`bytes` 类型无法混用,你必须始终在它们之间执行显式转换。 使用 "
353+ ":meth:`str.encode` 将 :class:`str` 转为 :class:`bytes`,并使用 :meth:`bytes.decode`"
354+ " 将 :class:`bytes` 转为 :class:`str`。 你也可以分别使用 ``bytes(s, encoding=...)`` 和 "
355+ "``str(b, encoding=...)``。"
346356
347357#: ../../whatsnew/3.0.rst:268
348358msgid ""
@@ -397,6 +407,13 @@ msgid ""
397407"have a way to override the encoding. There is no longer any need for using "
398408"the encoding-aware streams in the :mod:`codecs` module."
399409msgstr ""
410+ "作为文本文件打开的文件(仍然是 :func:`open` 的默认模式)总是会使用一个编码格式在(内存中的)字符串和(磁盘中的)字节串之间建立映射。 "
411+ "二进制文件(将 mode 参数设为 ``b`` 来打开)在内存中总是会使用数字串。 这意味着如果一个文件是使用不正确的模式或编码格式打开的,I/O "
412+ "操作很可能会报告失败,而不是静默地产生不正确的数据。 这也意味着即使是 Unix 用户在打开文件时也必须指定正确的模式(文本或二进制)。 "
413+ "存在一个依赖于具体平台的默认编码格式,在类 Unix 平台上可以通过 ``LANG`` "
414+ "环境变量来设置(有时也会使用其他一些平台专属的语言区域相关的环境变量)。 在多数情况下,系统默认使用 "
415+ "UTF-8,但并非全都如此;你绝不应该依赖这个默认值。 任何读写超出纯 ASCII 文本范围的内容的应用程序都应该提供重写编码格式的选项。 "
416+ "现在已不再需要使用 :mod:`codecs` 模块中可感知编码格式的流。"
400417
401418#: ../../whatsnew/3.0.rst:304
402419msgid ""
@@ -424,6 +441,12 @@ msgid ""
424441"of strings, filenames that cannot be decoded properly are omitted rather "
425442"than raising :exc:`UnicodeError`."
426443msgstr ""
444+ "文件名是以(Unicode)字符串的形式传给 API 并返回的。 这可能产生特定平台专属的问题因为在某些平台上文件名强制使用字节串。 (另一方面,在 "
445+ "Windows 上文件名则原生存储为 Unicode。) 为绕过此问题,多数接受文件名的 API(例如 :func:`open` 和 :mod:`os`"
446+ " 模块中的许多函数)都同时接受 :class:`bytes` 对象和字符串,而少数 API 会发出要求 :class:`bytes` 返回值的提示。 "
447+ "因而,当参数为 :class:`bytes` 的实例时 :func:`os.listdir` 会返回由 :class:`bytes` "
448+ "实例组成的列表,:func:`os.getcwdb` 则会将当前工作目录作为 :class:`bytes` 实例返回。 请注意当 "
449+ ":func:`os.listdir` 返回字符串的列表时,无法被正确解码的文件名会被忽略而不是引发 :exc:`UnicodeError`。"
427450
428451#: ../../whatsnew/3.0.rst:325
429452msgid ""
@@ -518,6 +541,8 @@ msgid ""
518541"now assign directly to a variable in an outer (but non-global) scope. "
519542":keyword:`!nonlocal` is a new reserved word."
520543msgstr ""
544+ ":pep:`3104`: :keyword:`nonlocal` 语句。 现在你可以使用 ``nonlocal x`` "
545+ "来允许直接赋值到一个外层(但非全局)作用域。 :keyword:`!nonlocal` 是新的保留字。"
521546
522547#: ../../whatsnew/3.0.rst:378
523548msgid ""
@@ -526,17 +551,21 @@ msgid ""
526551"``rest`` object is always a (possibly empty) list; the right-hand side may "
527552"be any iterable. Example::"
528553msgstr ""
554+ ":pep:`3132`: 扩展可迭代对象解包。 你现在可以编写像 ``a, b, *rest = some_sequence`` 这样的代码。 甚至 "
555+ "``*rest, a = stuff``。 ``rest`` 对象将总是为一个(可能为空的)列表;右侧的对象可以是任意可迭代对象。 例如::"
529556
530557#: ../../whatsnew/3.0.rst:385
531558msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``."
532- msgstr ""
559+ msgstr "这会将 *a* 设为 ``0``,*b* 设为 ``4``,而将 *rest* 设为 ``[1, 2, 3]``。 "
533560
534561#: ../../whatsnew/3.0.rst:387
535562msgid ""
536563"Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the same thing"
537564" as ``dict(stuff)`` but is more flexible. (This is :pep:`274` vindicated. "
538565":-)"
539566msgstr ""
567+ "新增字典推导式: ``{k: v for k, v in stuff}`` 的含义与 ``dict(stuff)`` 相同但是更为灵活。 "
568+ "(对此特性的解释见 :pep:`274`。 :-)"
540569
541570#: ../../whatsnew/3.0.rst:391
542571msgid ""
@@ -545,24 +574,26 @@ msgid ""
545574"``{x for x in stuff}`` means the same thing as ``set(stuff)`` but is more "
546575"flexible."
547576msgstr ""
577+ "新增集合字面值,例如 ``{1, 2}``。 请注意 ``{}`` 是空字典;要用 ``set()`` 表示空集合。 集合推导式也受到支持;例如 "
578+ "``{x for x in stuff}`` 的含义与 ``set(stuff)`` 相同但是更为灵活。"
548579
549580#: ../../whatsnew/3.0.rst:396
550581msgid ""
551582"New octal literals, e.g. ``0o720`` (already in 2.6). The old octal literals"
552583" (``0720``) are gone."
553- msgstr ""
584+ msgstr "新增八进制字面值,例如 ``0o720`` (已存在于 2.6 中)。 旧的八进制字面值 (``0720``) 已不复存在。 "
554585
555586#: ../../whatsnew/3.0.rst:399
556587msgid ""
557588"New binary literals, e.g. ``0b1010`` (already in 2.6), and there is a new "
558589"corresponding built-in function, :func:`bin`."
559- msgstr ""
590+ msgstr "新增二进制字面值,例如 ``0b1010`` (已存在于 2.6 中),还有对应的新增内置函数 :func:`bin`。 "
560591
561592#: ../../whatsnew/3.0.rst:402
562593msgid ""
563594"Bytes literals are introduced with a leading ``b`` or ``B``, and there is a "
564595"new corresponding built-in function, :func:`bytes`."
565- msgstr ""
596+ msgstr "引入了带有 ``b`` 或 ``B`` 前缀的字节串字面值,还有对应的新增内置函数 :func:`bytes`。 "
566597
567598#: ../../whatsnew/3.0.rst:406
568599msgid "Changed Syntax"
@@ -622,6 +653,9 @@ msgid ""
622653"inside a :func:`list` constructor, and in particular the loop control "
623654"variables are no longer leaked into the surrounding scope."
624655msgstr ""
656+ "列表推导式不再支持 :samp:`[... for {var} in {item1}, {item2}, ...]` 这样的语法形式。 请改用 "
657+ ":samp:`[... for {var} in ({item1}, {item2}, ...)]`。 还要注意列表推导式具有不同的句法:它们更像是 "
658+ ":func:`list` 构造器内部用于生成器表达式的语法糖,具体来说就是循环控制变量将不会再泄漏到外层作用域中。"
625659
626660#: ../../whatsnew/3.0.rst:444
627661msgid ""
@@ -642,14 +676,16 @@ msgid ""
642676":pep:`3113`: Tuple parameter unpacking removed. You can no longer write "
643677"``def foo(a, (b, c)): ...``. Use ``def foo(a, b_c): b, c = b_c`` instead."
644678msgstr ""
679+ ":pep:`3113`: 元组形参解包已被移除。 你不能再使用 ``def foo(a, (b, c)): ...`` 的写法。 请改用 ``def "
680+ "foo(a, b_c): b, c = b_c``。"
645681
646682#: ../../whatsnew/3.0.rst:456
647683msgid "Removed backticks (use :func:`repr` instead)."
648- msgstr ""
684+ msgstr "移除了反引号 (请改用 :func:`repr`)。 "
649685
650686#: ../../whatsnew/3.0.rst:458
651687msgid "Removed ``<>`` (use ``!=`` instead)."
652- msgstr ""
688+ msgstr "移除了 ``<>`` (请改用 ``!=``)。 "
653689
654690#: ../../whatsnew/3.0.rst:460
655691msgid ""
@@ -658,35 +694,40 @@ msgid ""
658694" note that :func:`exec` no longer takes a stream argument; instead of "
659695"``exec(f)`` you can use ``exec(f.read())``."
660696msgstr ""
697+ "移除的关键字: :func:`exec` 不再是一个关键字;它仍是一个函数。 (幸运的是该函数语法也在 2.x 中被接受。) 还要注意 "
698+ ":func:`exec` 将不再接受流作为参数;你可以将原来的 ``exec(f)`` 改为使用 ``exec(f.read())``。"
661699
662700#: ../../whatsnew/3.0.rst:465
663701msgid "Integer literals no longer support a trailing ``l`` or ``L``."
664- msgstr ""
702+ msgstr "整数字面值不再支持 ``l`` 或 ``L`` 后缀。 "
665703
666704#: ../../whatsnew/3.0.rst:467
667705msgid "String literals no longer support a leading ``u`` or ``U``."
668- msgstr ""
706+ msgstr "字符串字面值不再支持 ``u`` 或 ``U`` 前缀。 "
669707
670708#: ../../whatsnew/3.0.rst:469
671709msgid ""
672710"The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only allowed "
673711"at the module level, no longer inside functions."
674712msgstr ""
713+ ":keyword:`from` *module* :keyword:`import` ``*`` 语法仅允许在模块层级使用,不再允许出现于函数内部。"
675714
676715#: ../../whatsnew/3.0.rst:472
677716msgid ""
678717"The only acceptable syntax for relative imports is :samp:`from .[{module}] "
679718"import {name}`. All :keyword:`import` forms not starting with ``.`` are "
680719"interpreted as absolute imports. (:pep:`328`)"
681720msgstr ""
721+ "唯一可接受的相对导入语法为 :samp:`from .[{module}] import {name}`。 所有不以 ``.`` 开头的 "
722+ ":keyword:`import` 形式都将被解读为绝对导入。 (:pep:`328`)"
682723
683724#: ../../whatsnew/3.0.rst:476
684725msgid "Classic classes are gone."
685- msgstr ""
726+ msgstr "经典类已不复存在。 "
686727
687728#: ../../whatsnew/3.0.rst:480
688729msgid "Changes Already Present In Python 2.6"
689- msgstr ""
730+ msgstr "已存在于 Python 2.6 中的改变 "
690731
691732#: ../../whatsnew/3.0.rst:482
692733msgid ""
@@ -696,19 +737,23 @@ msgid ""
696737"corresponding sections in :ref:`whats-new-in-2.6` should be consulted for "
697738"longer descriptions."
698739msgstr ""
740+ "由于许多用户可能会直接从 Python 2.5 跳到 Python 3.0,因此本节提醒读者注意最初为 Python 3.0 设计但后来移植到 "
741+ "Python 2.6 的新特性。 如需更详细的说明请参阅 :ref:`whats-new-in-2.6` 中的相应章节。"
699742
700743#: ../../whatsnew/3.0.rst:488
701744msgid ""
702745":ref:`pep-0343`. The :keyword:`with` statement is now a standard feature "
703746"and no longer needs to be imported from the :mod:`__future__`. Also check "
704747"out :ref:`new-26-context-managers` and :ref:`new-module-contextlib`."
705748msgstr ""
749+ ":ref:`pep-0343`。 现在 :keyword:`with` 语句已是一个标准特性而不再需要从 :mod:`__future__` 导入。 "
750+ "另请参阅 :ref:`new-26-context-managers` 和 :ref:`new-module-contextlib`。"
706751
707752#: ../../whatsnew/3.0.rst:493
708753msgid ""
709754":ref:`pep-0366`. This enhances the usefulness of the :option:`-m` option "
710755"when the referenced module lives in a package."
711- msgstr ""
756+ msgstr ":ref:`pep-0366`。 这增强了 :option:`-m` 选项在被引用的模块位于包中时的实用性。 "
712757
713758#: ../../whatsnew/3.0.rst:496
714759msgid ":ref:`pep-0370`."
@@ -727,26 +772,33 @@ msgid ""
727772"API for string formatting, and to start deprecating the ``%`` operator in "
728773"Python 3.1."
729774msgstr ""
775+ ":ref:`pep-3101`。 注意:2.6 说明文档提到 :meth:`format` 方法同时适用于 8 位和 Unicode 字符串。 在 "
776+ "3.0 中,只有 :class:`str` 类型(带有 Unicode 支持的文本字符串)才支持此方法;:class:`bytes` 类型并不支持。 "
777+ "最终的计划是使其成为仅针对字符串格式化的 API,并在 Python 3.1 中开始弃用 ``%`` 字符串运算符。"
730778
731779#: ../../whatsnew/3.0.rst:507
732780msgid ""
733781":ref:`pep-3105`. This is now a standard feature and no longer needs to be "
734782"imported from :mod:`__future__`. More details were given above."
735- msgstr ""
783+ msgstr ":ref:`pep-3105`。 现在这已是一个标准特性而不再需要从 :mod:`__future__` 导入。 更多详情见上文。 "
736784
737785#: ../../whatsnew/3.0.rst:510
738786msgid ""
739787":ref:`pep-3110`. The :keyword:`except` *exc* :keyword:`!as` *var* syntax is"
740788" now standard and :keyword:`!except` *exc*, *var* is no longer supported. "
741789"(Of course, the :keyword:`!as` *var* part is still optional.)"
742790msgstr ""
791+ ":ref:`pep-3110`。 现在 :keyword:`except` *exc* :keyword:`!as` *var* 语法已成为标准而 "
792+ ":keyword:`!except` *exc*, *var* 不再受到支持。 (当然,:keyword:`!as` *var* 部分仍为可选项。)"
743793
744794#: ../../whatsnew/3.0.rst:515
745795msgid ""
746796":ref:`pep-3112`. The ``b\" ...\" `` string literal notation (and its variants"
747797" like ``b'...'``, ``b\"\"\" ...\"\"\" ``, and ``br\" ...\" ``) now produces a "
748798"literal of type :class:`bytes`."
749799msgstr ""
800+ ":ref:`pep-3112`。 现在 ``b\" ...\" `` 字节串字面值标记法(及其变化形式如 ``b'...'``, "
801+ "``b\"\"\" ...\"\"\" `` 和 ``br\" ...\" `` 等将产生 :class:`bytes` 类型的字面值。"
750802
751803#: ../../whatsnew/3.0.rst:519
752804msgid ""
@@ -783,7 +835,7 @@ msgstr ""
783835msgid ""
784836":ref:`pep-3127`. As mentioned above, the new octal literal notation is the "
785837"only one supported, and binary literals have been added."
786- msgstr ""
838+ msgstr ":ref:`pep-3127`。 如上文所述,新的八进制字面值标记法是唯一受支持的形式,并增加了二进制字面值。 "
787839
788840#: ../../whatsnew/3.0.rst:543
789841msgid ":ref:`pep-3129`."
@@ -795,6 +847,8 @@ msgid ""
795847"defining Python's\" numeric tower\" . Also note the new :mod:`fractions` "
796848"module which implements :class:`numbers.Rational`."
797849msgstr ""
850+ ":ref:`pep-3141`。 :mod:`numbers` 模块是 ABC 的另一个新用例,它定义了 Python 的“数字层级塔”。 另请注意新的"
851+ " :mod:`fractions` 模块,它实现了 :class:`numbers.Rational`。"
798852
799853#: ../../whatsnew/3.0.rst:551
800854msgid "Library Changes"
@@ -831,7 +885,7 @@ msgstr ""
831885msgid ""
832886"Some modules were renamed because their old name disobeyed :pep:`8`, or for "
833887"various other reasons. Here's the list:"
834- msgstr ""
888+ msgstr "一些模块名称已被修改因为它们的旧名称不符合 :pep:`8`,或是出于各种其他理由。 具体列表如下: "
835889
836890#: ../../whatsnew/3.0.rst:576
837891msgid "Old Name"
@@ -1416,4 +1470,4 @@ msgstr ""
14161470#: ../../whatsnew/3.0.rst:929
14171471msgid ""
14181472"For porting C extensions to Python 3.0, please see :ref:`cporting-howto`."
1419- msgstr ""
1473+ msgstr "有关如何将 C 扩展移植到 Python 3.0,请参阅 :ref:`cporting-howto`。 "