@@ -819,6 +819,8 @@ msgid ""
819
819
" multiple subgenerators as easily as a single large function can be split "
820
820
"into multiple subfunctions."
821
821
msgstr ""
822
+ "推动这项改变的主要原则是允许即便被设计用来配合 ``send`` 和 ``throw`` "
823
+ "方法使用的生成器也能像一个大函数能拆分成多个子函数那样容易地拆分为多个子生成器。"
822
824
823
825
#: ../../whatsnew/3.3.rst:462
824
826
msgid ":pep:`380` - Syntax for Delegating to a Subgenerator"
@@ -842,7 +844,7 @@ msgid ""
842
844
"PEP 409 introduces new syntax that allows the display of the chained "
843
845
"exception context to be disabled. This allows cleaner error messages in "
844
846
"applications that convert between exception types::"
845
- msgstr ""
847
+ msgstr "PEP 409 引入了允许禁用串连的异常上下文显示的新语法。 这允许在不同异常类型间进行转换的应用程序具有更清晰的错误消息:: "
846
848
847
849
#: ../../whatsnew/3.3.rst:475
848
850
msgid ""
@@ -861,12 +863,26 @@ msgid ""
861
863
" File\" <stdin>\" , line 8, in __getattr__\n"
862
864
"AttributeError: x"
863
865
msgstr ""
866
+ ">>> class D:\n"
867
+ "... def __init__(self, extra):\n"
868
+ "... self._extra_attributes = extra\n"
869
+ "... def __getattr__(self, attr):\n"
870
+ "... try:\n"
871
+ "... return self._extra_attributes[attr]\n"
872
+ "... except KeyError:\n"
873
+ "... raise AttributeError(attr) from None\n"
874
+ "...\n"
875
+ ">>> D({}).x\n"
876
+ "Traceback (most recent call last):\n"
877
+ " File\" <stdin>\" , line 1, in <module>\n"
878
+ " File\" <stdin>\" , line 8, in __getattr__\n"
879
+ "AttributeError: x"
864
880
865
881
#: ../../whatsnew/3.3.rst:490
866
882
msgid ""
867
883
"Without the ``from None`` suffix to suppress the cause, the original "
868
884
"exception would be displayed by default::"
869
- msgstr ""
885
+ msgstr "如果后面没有 ``from None`` 来屏蔽异常原因,则默认原始异常将被显示:: "
870
886
871
887
#: ../../whatsnew/3.3.rst:493
872
888
msgid ""
@@ -891,6 +907,26 @@ msgid ""
891
907
" File\" <stdin>\" , line 8, in __getattr__\n"
892
908
"AttributeError: x"
893
909
msgstr ""
910
+ ">>> class C:\n"
911
+ "... def __init__(self, extra):\n"
912
+ "... self._extra_attributes = extra\n"
913
+ "... def __getattr__(self, attr):\n"
914
+ "... try:\n"
915
+ "... return self._extra_attributes[attr]\n"
916
+ "... except KeyError:\n"
917
+ "... raise AttributeError(attr)\n"
918
+ "...\n"
919
+ ">>> C({}).x\n"
920
+ "Traceback (most recent call last):\n"
921
+ " File\" <stdin>\" , line 6, in __getattr__\n"
922
+ "KeyError: 'x'\n"
923
+ "\n"
924
+ "During handling of the above exception, another exception occurred:\n"
925
+ "\n"
926
+ "Traceback (most recent call last):\n"
927
+ " File\" <stdin>\" , line 1, in <module>\n"
928
+ " File\" <stdin>\" , line 8, in __getattr__\n"
929
+ "AttributeError: x"
894
930
895
931
#: ../../whatsnew/3.3.rst:514
896
932
msgid ""