@@ -2672,6 +2672,14 @@ msgid ""
2672
2672
"from :mod:`sys` (or setting it to some other callable). (Contributed by "
2673
2673
"Éric Araujo and Antoine Pitrou in :issue:`5845`.)"
2674
2674
msgstr ""
2675
+ "当 Python 解释器以 :ref:`交互模式 <tut-interactive>` 启动时,它会检查 :mod:`sys` 模块中的 "
2676
+ ":data:`~sys.__interactivehook__` 属性。 如果该属性存在,它的值将在交互模式启动之前不附带参数地被调用。 "
2677
+ "这个检查是在读取 :envvar:`PYTHONSTARTUP` 文件之后进行的,因此可以在那里设置它。 :mod:`site` 模块会在平台支持 "
2678
+ ":mod:`readline` 的情况下 :ref:`把它设置为 <rlcompleter-config>` 一个启用制表符补全和历史记录保存(在 "
2679
+ ":file:`~/.python-history` 中)的函数。 如果你不想要这个(新增的)行为,可以通过从 :mod:`sys` "
2680
+ "中删除这个属性(或将其设为其他可调用对象)在 :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize` 或 "
2681
+ ":mod:`usercustomize` 中覆盖它。 (由 Éric Araujo 和 Antoine Pitrou 在 :issue:`5845` "
2682
+ "中贡献。)"
2675
2683
2676
2684
#: ../../whatsnew/3.4.rst:1573
2677
2685
msgid "tarfile"
@@ -2684,6 +2692,8 @@ msgid ""
2684
2692
"and extract tarfile archives. (Contributed by Berker Peksag in "
2685
2693
":issue:`13477`.)"
2686
2694
msgstr ""
2695
+ "现在 :mod:`tarfile` 模块当直接作为脚本或通过 ``-m`` 调用时将支持简单的 :ref:`tarfile-commandline`。 "
2696
+ "这可被用来创建和提取 tar 归档文件。 (由 Berker Peksag 在 :issue:`13477` 中贡献。)"
2687
2697
2688
2698
#: ../../whatsnew/3.4.rst:1581
2689
2699
msgid "textwrap"
@@ -2702,6 +2712,12 @@ msgid ""
2702
2712
"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and "
2703
2713
":issue:`18725`.)"
2704
2714
msgstr ""
2715
+ ":class:`~textwrap.TextWrapper` 类新增了两个属性/构造器参数: "
2716
+ ":attr:`~textwrap.TextWrapper.max_lines`,用来限制输出的行数,以及 "
2717
+ ":attr:`~textwrap.TextWrapper.placeholder`,它是一个当输出由于 *max_lines* "
2718
+ "限制被截断时将出现在输出末尾处的字符串。 一个在此功能之上新增的便捷函数 :func:`~textwrap.shorten` "
2719
+ "可将输入中的所有空格压缩为单个空格并产生一个宽度为 *width* 并以 *placeholder* (默认为 ``[...]``) 结束的单独行。 "
2720
+ "(由 Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`18585` 和 :issue:`18725` 中贡献。)"
2705
2721
2706
2722
#: ../../whatsnew/3.4.rst:1595
2707
2723
msgid "threading"
@@ -2714,6 +2730,9 @@ msgid ""
2714
2730
"conditions this will be the thread from which the Python interpreter was "
2715
2731
"started. (Contributed by Andrew Svetlov in :issue:`18882`.)"
2716
2732
msgstr ""
2733
+ "代表可通过新增的 :func:`~threading.main_thread` 函数来获取的主线程的 "
2734
+ ":class:`~threading.Thread` 对象。 在通常条件下这将是启动 Python 解释器所在的线程。 (由 Andrew "
2735
+ "Svetlov 在 :issue:`18882` 中贡献。)"
2717
2736
2718
2737
#: ../../whatsnew/3.4.rst:1604
2719
2738
msgid "traceback"
@@ -2726,6 +2745,8 @@ msgid ""
2726
2745
"amount of memory consumed. (Contributed by Andrew Kuchling in "
2727
2746
":issue:`1565525`.)"
2728
2747
msgstr ""
2748
+ "新增的 :func:`traceback.clear_frames` 函数可接受一个回溯对象清除它所引用的所有帧中的局部变量,以减少内存消耗量。 (由 "
2749
+ "Andrew Kuchling 在 :issue:`1565525` 中贡献。)"
2729
2750
2730
2751
#: ../../whatsnew/3.4.rst:1613
2731
2752
msgid "types"
0 commit comments