@@ -2619,6 +2619,14 @@ msgid ""
2619
2619
"from :mod:`sys` (or setting it to some other callable). (Contributed by "
2620
2620
"Éric Araujo and Antoine Pitrou in :issue:`5845`.)"
2621
2621
msgstr ""
2622
+ "当 Python 解释器以 :ref:`交互模式 <tut-interactive>` 启动时,它会检查 :mod:`sys` 模块中的 "
2623
+ ":data:`~sys.__interactivehook__` 属性。 如果该属性存在,它的值将在交互模式启动之前不附带参数地被调用。 "
2624
+ "这个检查是在读取 :envvar:`PYTHONSTARTUP` 文件之后进行的,因此可以在那里设置它。 :mod:`site` 模块会在平台支持 "
2625
+ ":mod:`readline` 的情况下 :ref:`把它设置为 <rlcompleter-config>` 一个启用制表符补全和历史记录保存(在 "
2626
+ ":file:`~/.python-history` 中)的函数。 如果你不想要这个(新增的)行为,可以通过从 :mod:`sys` "
2627
+ "中删除这个属性(或将其设为其他可调用对象)在 :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize` 或 "
2628
+ ":mod:`usercustomize` 中覆盖它。 (由 Éric Araujo 和 Antoine Pitrou 在 :issue:`5845` "
2629
+ "中贡献。)"
2622
2630
2623
2631
#: ../../whatsnew/3.4.rst:1573
2624
2632
msgid "tarfile"
@@ -2631,6 +2639,8 @@ msgid ""
2631
2639
"and extract tarfile archives. (Contributed by Berker Peksag in "
2632
2640
":issue:`13477`.)"
2633
2641
msgstr ""
2642
+ "现在 :mod:`tarfile` 模块当直接作为脚本或通过 ``-m`` 调用时将支持简单的 :ref:`tarfile-commandline`。 "
2643
+ "这可被用来创建和提取 tar 归档文件。 (由 Berker Peksag 在 :issue:`13477` 中贡献。)"
2634
2644
2635
2645
#: ../../whatsnew/3.4.rst:1581
2636
2646
msgid "textwrap"
@@ -2649,6 +2659,12 @@ msgid ""
2649
2659
"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and "
2650
2660
":issue:`18725`.)"
2651
2661
msgstr ""
2662
+ ":class:`~textwrap.TextWrapper` 类新增了两个属性/构造器参数: "
2663
+ ":attr:`~textwrap.TextWrapper.max_lines`,用来限制输出的行数,以及 "
2664
+ ":attr:`~textwrap.TextWrapper.placeholder`,它是一个当输出由于 *max_lines* "
2665
+ "限制被截断时将出现在输出末尾处的字符串。 一个在此功能之上新增的便捷函数 :func:`~textwrap.shorten` "
2666
+ "可将输入中的所有空格压缩为单个空格并产生一个宽度为 *width* 并以 *placeholder* (默认为 ``[...]``) 结束的单独行。 "
2667
+ "(由 Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`18585` 和 :issue:`18725` 中贡献。)"
2652
2668
2653
2669
#: ../../whatsnew/3.4.rst:1595
2654
2670
msgid "threading"
@@ -2661,6 +2677,9 @@ msgid ""
2661
2677
"conditions this will be the thread from which the Python interpreter was "
2662
2678
"started. (Contributed by Andrew Svetlov in :issue:`18882`.)"
2663
2679
msgstr ""
2680
+ "代表可通过新增的 :func:`~threading.main_thread` 函数来获取的主线程的 "
2681
+ ":class:`~threading.Thread` 对象。 在通常条件下这将是启动 Python 解释器所在的线程。 (由 Andrew "
2682
+ "Svetlov 在 :issue:`18882` 中贡献。)"
2664
2683
2665
2684
#: ../../whatsnew/3.4.rst:1604
2666
2685
msgid "traceback"
@@ -2673,6 +2692,8 @@ msgid ""
2673
2692
"amount of memory consumed. (Contributed by Andrew Kuchling in "
2674
2693
":issue:`1565525`.)"
2675
2694
msgstr ""
2695
+ "新增的 :func:`traceback.clear_frames` 函数可接受一个回溯对象清除它所引用的所有帧中的局部变量,以减少内存消耗量。 (由 "
2696
+ "Andrew Kuchling 在 :issue:`1565525` 中贡献。)"
2676
2697
2677
2698
#: ../../whatsnew/3.4.rst:1613
2678
2699
msgid "types"
0 commit comments