@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.11\n "
13
13
"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 "
15
15
"PO-Revision-Date : 2023-05-24 02:23+0000\n "
16
16
"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2025\n "
17
17
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -317,6 +317,12 @@ msgid ""
317
317
":exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-"
318
318
"specific behavior has caused numerous sad faces over the years."
319
319
msgstr ""
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
+ "这种依赖于特定值的行为多年来造成了无数的苦恼。"
320
326
321
327
#: ../../whatsnew/3.0.rst:250
322
328
msgid ""
@@ -343,6 +349,10 @@ msgid ""
343
349
":class:`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)``"
344
350
" and ``str(b, encoding=...)``, respectively."
345
351
msgstr ""
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=...)``。"
346
356
347
357
#: ../../whatsnew/3.0.rst:268
348
358
msgid ""
@@ -397,6 +407,13 @@ msgid ""
397
407
"have a way to override the encoding. There is no longer any need for using "
398
408
"the encoding-aware streams in the :mod:`codecs` module."
399
409
msgstr ""
410
+ "作为文本文件打开的文件(仍然是 :func:`open` 的默认模式)总是会使用一个编码格式在(内存中的)字符串和(磁盘中的)字节串之间建立映射。 "
411
+ "二进制文件(将 mode 参数设为 ``b`` 来打开)在内存中总是会使用数字串。 这意味着如果一个文件是使用不正确的模式或编码格式打开的,I/O "
412
+ "操作很可能会报告失败,而不是静默地产生不正确的数据。 这也意味着即使是 Unix 用户在打开文件时也必须指定正确的模式(文本或二进制)。 "
413
+ "存在一个依赖于具体平台的默认编码格式,在类 Unix 平台上可以通过 ``LANG`` "
414
+ "环境变量来设置(有时也会使用其他一些平台专属的语言区域相关的环境变量)。 在多数情况下,系统默认使用 "
415
+ "UTF-8,但并非全都如此;你绝不应该依赖这个默认值。 任何读写超出纯 ASCII 文本范围的内容的应用程序都应该提供重写编码格式的选项。 "
416
+ "现在已不再需要使用 :mod:`codecs` 模块中可感知编码格式的流。"
400
417
401
418
#: ../../whatsnew/3.0.rst:304
402
419
msgid ""
@@ -424,6 +441,12 @@ msgid ""
424
441
"of strings, filenames that cannot be decoded properly are omitted rather "
425
442
"than raising :exc:`UnicodeError`."
426
443
msgstr ""
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`。"
427
450
428
451
#: ../../whatsnew/3.0.rst:325
429
452
msgid ""
@@ -518,6 +541,8 @@ msgid ""
518
541
"now assign directly to a variable in an outer (but non-global) scope. "
519
542
":keyword:`!nonlocal` is a new reserved word."
520
543
msgstr ""
544
+ ":pep:`3104`: :keyword:`nonlocal` 语句。 现在你可以使用 ``nonlocal x`` "
545
+ "来允许直接赋值到一个外层(但非全局)作用域。 :keyword:`!nonlocal` 是新的保留字。"
521
546
522
547
#: ../../whatsnew/3.0.rst:378
523
548
msgid ""
@@ -526,17 +551,21 @@ msgid ""
526
551
"``rest`` object is always a (possibly empty) list; the right-hand side may "
527
552
"be any iterable. Example::"
528
553
msgstr ""
554
+ ":pep:`3132`: 扩展可迭代对象解包。 你现在可以编写像 ``a, b, *rest = some_sequence`` 这样的代码。 甚至 "
555
+ "``*rest, a = stuff``。 ``rest`` 对象将总是为一个(可能为空的)列表;右侧的对象可以是任意可迭代对象。 例如::"
529
556
530
557
#: ../../whatsnew/3.0.rst:385
531
558
msgid "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]``。 "
533
560
534
561
#: ../../whatsnew/3.0.rst:387
535
562
msgid ""
536
563
"Dictionary comprehensions: ``{k: v for k, v in stuff}`` means the same thing"
537
564
" as ``dict(stuff)`` but is more flexible. (This is :pep:`274` vindicated. "
538
565
":-)"
539
566
msgstr ""
567
+ "新增字典推导式: ``{k: v for k, v in stuff}`` 的含义与 ``dict(stuff)`` 相同但是更为灵活。 "
568
+ "(对此特性的解释见 :pep:`274`。 :-)"
540
569
541
570
#: ../../whatsnew/3.0.rst:391
542
571
msgid ""
@@ -545,24 +574,26 @@ msgid ""
545
574
"``{x for x in stuff}`` means the same thing as ``set(stuff)`` but is more "
546
575
"flexible."
547
576
msgstr ""
577
+ "新增集合字面值,例如 ``{1, 2}``。 请注意 ``{}`` 是空字典;要用 ``set()`` 表示空集合。 集合推导式也受到支持;例如 "
578
+ "``{x for x in stuff}`` 的含义与 ``set(stuff)`` 相同但是更为灵活。"
548
579
549
580
#: ../../whatsnew/3.0.rst:396
550
581
msgid ""
551
582
"New octal literals, e.g. ``0o720`` (already in 2.6). The old octal literals"
552
583
" (``0720``) are gone."
553
- msgstr ""
584
+ msgstr "新增八进制字面值,例如 ``0o720`` (已存在于 2.6 中)。 旧的八进制字面值 (``0720``) 已不复存在。 "
554
585
555
586
#: ../../whatsnew/3.0.rst:399
556
587
msgid ""
557
588
"New binary literals, e.g. ``0b1010`` (already in 2.6), and there is a new "
558
589
"corresponding built-in function, :func:`bin`."
559
- msgstr ""
590
+ msgstr "新增二进制字面值,例如 ``0b1010`` (已存在于 2.6 中),还有对应的新增内置函数 :func:`bin`。 "
560
591
561
592
#: ../../whatsnew/3.0.rst:402
562
593
msgid ""
563
594
"Bytes literals are introduced with a leading ``b`` or ``B``, and there is a "
564
595
"new corresponding built-in function, :func:`bytes`."
565
- msgstr ""
596
+ msgstr "引入了带有 ``b`` 或 ``B`` 前缀的字节串字面值,还有对应的新增内置函数 :func:`bytes`。 "
566
597
567
598
#: ../../whatsnew/3.0.rst:406
568
599
msgid "Changed Syntax"
@@ -622,6 +653,9 @@ msgid ""
622
653
"inside a :func:`list` constructor, and in particular the loop control "
623
654
"variables are no longer leaked into the surrounding scope."
624
655
msgstr ""
656
+ "列表推导式不再支持 :samp:`[... for {var} in {item1}, {item2}, ...]` 这样的语法形式。 请改用 "
657
+ ":samp:`[... for {var} in ({item1}, {item2}, ...)]`。 还要注意列表推导式具有不同的句法:它们更像是 "
658
+ ":func:`list` 构造器内部用于生成器表达式的语法糖,具体来说就是循环控制变量将不会再泄漏到外层作用域中。"
625
659
626
660
#: ../../whatsnew/3.0.rst:444
627
661
msgid ""
@@ -642,14 +676,16 @@ msgid ""
642
676
":pep:`3113`: Tuple parameter unpacking removed. You can no longer write "
643
677
"``def foo(a, (b, c)): ...``. Use ``def foo(a, b_c): b, c = b_c`` instead."
644
678
msgstr ""
679
+ ":pep:`3113`: 元组形参解包已被移除。 你不能再使用 ``def foo(a, (b, c)): ...`` 的写法。 请改用 ``def "
680
+ "foo(a, b_c): b, c = b_c``。"
645
681
646
682
#: ../../whatsnew/3.0.rst:456
647
683
msgid "Removed backticks (use :func:`repr` instead)."
648
- msgstr ""
684
+ msgstr "移除了反引号 (请改用 :func:`repr`)。 "
649
685
650
686
#: ../../whatsnew/3.0.rst:458
651
687
msgid "Removed ``<>`` (use ``!=`` instead)."
652
- msgstr ""
688
+ msgstr "移除了 ``<>`` (请改用 ``!=``)。 "
653
689
654
690
#: ../../whatsnew/3.0.rst:460
655
691
msgid ""
@@ -658,35 +694,40 @@ msgid ""
658
694
" note that :func:`exec` no longer takes a stream argument; instead of "
659
695
"``exec(f)`` you can use ``exec(f.read())``."
660
696
msgstr ""
697
+ "移除的关键字: :func:`exec` 不再是一个关键字;它仍是一个函数。 (幸运的是该函数语法也在 2.x 中被接受。) 还要注意 "
698
+ ":func:`exec` 将不再接受流作为参数;你可以将原来的 ``exec(f)`` 改为使用 ``exec(f.read())``。"
661
699
662
700
#: ../../whatsnew/3.0.rst:465
663
701
msgid "Integer literals no longer support a trailing ``l`` or ``L``."
664
- msgstr ""
702
+ msgstr "整数字面值不再支持 ``l`` 或 ``L`` 后缀。 "
665
703
666
704
#: ../../whatsnew/3.0.rst:467
667
705
msgid "String literals no longer support a leading ``u`` or ``U``."
668
- msgstr ""
706
+ msgstr "字符串字面值不再支持 ``u`` 或 ``U`` 前缀。 "
669
707
670
708
#: ../../whatsnew/3.0.rst:469
671
709
msgid ""
672
710
"The :keyword:`from` *module* :keyword:`import` ``*`` syntax is only allowed "
673
711
"at the module level, no longer inside functions."
674
712
msgstr ""
713
+ ":keyword:`from` *module* :keyword:`import` ``*`` 语法仅允许在模块层级使用,不再允许出现于函数内部。"
675
714
676
715
#: ../../whatsnew/3.0.rst:472
677
716
msgid ""
678
717
"The only acceptable syntax for relative imports is :samp:`from .[{module}] "
679
718
"import {name}`. All :keyword:`import` forms not starting with ``.`` are "
680
719
"interpreted as absolute imports. (:pep:`328`)"
681
720
msgstr ""
721
+ "唯一可接受的相对导入语法为 :samp:`from .[{module}] import {name}`。 所有不以 ``.`` 开头的 "
722
+ ":keyword:`import` 形式都将被解读为绝对导入。 (:pep:`328`)"
682
723
683
724
#: ../../whatsnew/3.0.rst:476
684
725
msgid "Classic classes are gone."
685
- msgstr ""
726
+ msgstr "经典类已不复存在。 "
686
727
687
728
#: ../../whatsnew/3.0.rst:480
688
729
msgid "Changes Already Present In Python 2.6"
689
- msgstr ""
730
+ msgstr "已存在于 Python 2.6 中的改变 "
690
731
691
732
#: ../../whatsnew/3.0.rst:482
692
733
msgid ""
@@ -696,19 +737,23 @@ msgid ""
696
737
"corresponding sections in :ref:`whats-new-in-2.6` should be consulted for "
697
738
"longer descriptions."
698
739
msgstr ""
740
+ "由于许多用户可能会直接从 Python 2.5 跳到 Python 3.0,因此本节提醒读者注意最初为 Python 3.0 设计但后来移植到 "
741
+ "Python 2.6 的新特性。 如需更详细的说明请参阅 :ref:`whats-new-in-2.6` 中的相应章节。"
699
742
700
743
#: ../../whatsnew/3.0.rst:488
701
744
msgid ""
702
745
":ref:`pep-0343`. The :keyword:`with` statement is now a standard feature "
703
746
"and no longer needs to be imported from the :mod:`__future__`. Also check "
704
747
"out :ref:`new-26-context-managers` and :ref:`new-module-contextlib`."
705
748
msgstr ""
749
+ ":ref:`pep-0343`。 现在 :keyword:`with` 语句已是一个标准特性而不再需要从 :mod:`__future__` 导入。 "
750
+ "另请参阅 :ref:`new-26-context-managers` 和 :ref:`new-module-contextlib`。"
706
751
707
752
#: ../../whatsnew/3.0.rst:493
708
753
msgid ""
709
754
":ref:`pep-0366`. This enhances the usefulness of the :option:`-m` option "
710
755
"when the referenced module lives in a package."
711
- msgstr ""
756
+ msgstr ":ref:`pep-0366`。 这增强了 :option:`-m` 选项在被引用的模块位于包中时的实用性。 "
712
757
713
758
#: ../../whatsnew/3.0.rst:496
714
759
msgid ":ref:`pep-0370`."
@@ -727,26 +772,33 @@ msgid ""
727
772
"API for string formatting, and to start deprecating the ``%`` operator in "
728
773
"Python 3.1."
729
774
msgstr ""
775
+ ":ref:`pep-3101`。 注意:2.6 说明文档提到 :meth:`format` 方法同时适用于 8 位和 Unicode 字符串。 在 "
776
+ "3.0 中,只有 :class:`str` 类型(带有 Unicode 支持的文本字符串)才支持此方法;:class:`bytes` 类型并不支持。 "
777
+ "最终的计划是使其成为仅针对字符串格式化的 API,并在 Python 3.1 中开始弃用 ``%`` 字符串运算符。"
730
778
731
779
#: ../../whatsnew/3.0.rst:507
732
780
msgid ""
733
781
":ref:`pep-3105`. This is now a standard feature and no longer needs to be "
734
782
"imported from :mod:`__future__`. More details were given above."
735
- msgstr ""
783
+ msgstr ":ref:`pep-3105`。 现在这已是一个标准特性而不再需要从 :mod:`__future__` 导入。 更多详情见上文。 "
736
784
737
785
#: ../../whatsnew/3.0.rst:510
738
786
msgid ""
739
787
":ref:`pep-3110`. The :keyword:`except` *exc* :keyword:`!as` *var* syntax is"
740
788
" now standard and :keyword:`!except` *exc*, *var* is no longer supported. "
741
789
"(Of course, the :keyword:`!as` *var* part is still optional.)"
742
790
msgstr ""
791
+ ":ref:`pep-3110`。 现在 :keyword:`except` *exc* :keyword:`!as` *var* 语法已成为标准而 "
792
+ ":keyword:`!except` *exc*, *var* 不再受到支持。 (当然,:keyword:`!as` *var* 部分仍为可选项。)"
743
793
744
794
#: ../../whatsnew/3.0.rst:515
745
795
msgid ""
746
796
":ref:`pep-3112`. The ``b\" ...\" `` string literal notation (and its variants"
747
797
" like ``b'...'``, ``b\"\"\" ...\"\"\" ``, and ``br\" ...\" ``) now produces a "
748
798
"literal of type :class:`bytes`."
749
799
msgstr ""
800
+ ":ref:`pep-3112`。 现在 ``b\" ...\" `` 字节串字面值标记法(及其变化形式如 ``b'...'``, "
801
+ "``b\"\"\" ...\"\"\" `` 和 ``br\" ...\" `` 等将产生 :class:`bytes` 类型的字面值。"
750
802
751
803
#: ../../whatsnew/3.0.rst:519
752
804
msgid ""
@@ -783,7 +835,7 @@ msgstr ""
783
835
msgid ""
784
836
":ref:`pep-3127`. As mentioned above, the new octal literal notation is the "
785
837
"only one supported, and binary literals have been added."
786
- msgstr ""
838
+ msgstr ":ref:`pep-3127`。 如上文所述,新的八进制字面值标记法是唯一受支持的形式,并增加了二进制字面值。 "
787
839
788
840
#: ../../whatsnew/3.0.rst:543
789
841
msgid ":ref:`pep-3129`."
@@ -795,6 +847,8 @@ msgid ""
795
847
"defining Python's \" numeric tower\" . Also note the new :mod:`fractions` "
796
848
"module which implements :class:`numbers.Rational`."
797
849
msgstr ""
850
+ ":ref:`pep-3141`。 :mod:`numbers` 模块是 ABC 的另一个新用例,它定义了 Python 的“数字层级塔”。 另请注意新的"
851
+ " :mod:`fractions` 模块,它实现了 :class:`numbers.Rational`。"
798
852
799
853
#: ../../whatsnew/3.0.rst:551
800
854
msgid "Library Changes"
@@ -831,7 +885,7 @@ msgstr ""
831
885
msgid ""
832
886
"Some modules were renamed because their old name disobeyed :pep:`8`, or for "
833
887
"various other reasons. Here's the list:"
834
- msgstr ""
888
+ msgstr "一些模块名称已被修改因为它们的旧名称不符合 :pep:`8`,或是出于各种其他理由。 具体列表如下: "
835
889
836
890
#: ../../whatsnew/3.0.rst:576
837
891
msgid "Old Name"
@@ -1416,4 +1470,4 @@ msgstr ""
1416
1470
#: ../../whatsnew/3.0.rst:929
1417
1471
msgid ""
1418
1472
"For porting C extensions to Python 3.0, please see :ref:`cporting-howto`."
1419
- msgstr ""
1473
+ msgstr "有关如何将 C 扩展移植到 Python 3.0,请参阅 :ref:`cporting-howto`。 "
0 commit comments