@@ -15,7 +15,7 @@ msgid ""
1515msgstr ""
1616"Project-Id-Version : Python 3.9\n "
1717"Report-Msgid-Bugs-To : \n "
18- "POT-Creation-Date : 2021-01-01 05:02 +0000\n "
18+ "POT-Creation-Date : 2021-03-15 05:42 +0000\n "
1919"PO-Revision-Date : 2017-02-16 17:42+0000\n "
2020"
Last-Translator :
Freesand Leo <[email protected] >, 2020\n "
2121"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -916,32 +916,40 @@ msgstr "为什么没有goto?"
916916
917917#: ../../faq/design.rst:604
918918msgid ""
919- "You can use exceptions to provide a \" structured goto\" that even works "
920- "across function calls. Many feel that exceptions can conveniently emulate "
919+ "In the 1970s people realized that unrestricted goto could lead to messy "
920+ "\" sphagetti\" code that was hard to understand and revise. In a high-level "
921+ "language, it is also unneeded as long as there are ways to branch (in "
922+ "Python, with ``if`` statements and ``or``, ``and``, and ``if-else`` "
923+ "expressions) and loop (with ``while`` and ``for`` statements, possibly "
924+ "containing ``continue`` and ``break``)."
925+ msgstr ""
926+
927+ #: ../../faq/design.rst:611
928+ msgid ""
929+ "One can also use exceptions to provide a \" structured goto\" that works even"
930+ " across function calls. Many feel that exceptions can conveniently emulate "
921931"all reasonable uses of the \" go\" or \" goto\" constructs of C, Fortran, and "
922932"other languages. For example::"
923933msgstr ""
924- "可以使用异常捕获来提供 “goto结构” ,甚至可以跨函数调用工作的 。许多人认为异常捕获可以方便地模拟C,Fortran和其他语言的 \" go\" 或"
925- " \" goto\" 结构的所有合理用法。例如::"
926934
927- #: ../../faq/design.rst:619
935+ #: ../../faq/design.rst:627
928936msgid ""
929937"This doesn't allow you to jump into the middle of a loop, but that's usually"
930938" considered an abuse of goto anyway. Use sparingly."
931939msgstr "但是不允许你跳到循环的中间,这通常被认为是滥用goto。谨慎使用。"
932940
933- #: ../../faq/design.rst:624
941+ #: ../../faq/design.rst:632
934942msgid "Why can't raw strings (r-strings) end with a backslash?"
935943msgstr "为什么原始字符串(r-strings)不能以反斜杠结尾?"
936944
937- #: ../../faq/design.rst:626
945+ #: ../../faq/design.rst:634
938946msgid ""
939947"More precisely, they can't end with an odd number of backslashes: the "
940948"unpaired backslash at the end escapes the closing quote character, leaving "
941949"an unterminated string."
942950msgstr "更准确地说,它们不能以奇数个反斜杠结束:结尾处的不成对反斜杠会转义结束引号字符,留下未结束的字符串。"
943951
944- #: ../../faq/design.rst:630
952+ #: ../../faq/design.rst:638
945953msgid ""
946954"Raw strings were designed to ease creating input for processors (chiefly "
947955"regular expression engines) that want to do their own backslash escape "
@@ -953,33 +961,33 @@ msgstr ""
953961"原始字符串的设计是为了方便想要执行自己的反斜杠转义处理的处理器(主要是正则表达式引擎)创建输入。此类处理器将不匹配的尾随反斜杠视为错误,因此原始字符串不允许这样做。反过来,允许通过使用引号字符转义反斜杠转义字符串"
954962"。当r-string用于它们的预期目的时,这些规则工作的很好。"
955963
956- #: ../../faq/design.rst:637
964+ #: ../../faq/design.rst:645
957965msgid ""
958966"If you're trying to build Windows pathnames, note that all Windows system "
959967"calls accept forward slashes too::"
960968msgstr "如果您正在尝试构建Windows路径名,请注意所有Windows系统调用都使用正斜杠::"
961969
962- #: ../../faq/design.rst:642
970+ #: ../../faq/design.rst:650
963971msgid ""
964972"If you're trying to build a pathname for a DOS command, try e.g. one of ::"
965973msgstr "如果您正在尝试为DOS命令构建路径名,请尝试以下示例 ::"
966974
967- #: ../../faq/design.rst:650
975+ #: ../../faq/design.rst:658
968976msgid "Why doesn't Python have a \" with\" statement for attribute assignments?"
969977msgstr "为什么Python没有属性赋值的“with”语句?"
970978
971- #: ../../faq/design.rst:652
979+ #: ../../faq/design.rst:660
972980msgid ""
973981"Python has a 'with' statement that wraps the execution of a block, calling "
974982"code on the entrance and exit from the block. Some languages have a "
975983"construct that looks like this::"
976984msgstr "Python 具有 'with' 语句,它能将一个代码块的执行包装起来,在进入和退出代码块时调用特定的代码。 有些语言具有这样的结构::"
977985
978- #: ../../faq/design.rst:660
986+ #: ../../faq/design.rst:668
979987msgid "In Python, such a construct would be ambiguous."
980988msgstr "在Python中,这样的结构是不明确的。"
981989
982- #: ../../faq/design.rst:662
990+ #: ../../faq/design.rst:670
983991msgid ""
984992"Other languages, such as Object Pascal, Delphi, and C++, use static types, "
985993"so it's possible to know, in an unambiguous way, what member is being "
@@ -989,7 +997,7 @@ msgstr ""
989997"其他语言,如ObjectPascal、Delphi和C++ 使用静态类型,因此可以毫不含糊地知道分配给什么成员。这是静态类型的要点 -- 编译器 "
990998"*总是* 在编译时知道每个变量的作用域。"
991999
992- #: ../../faq/design.rst:667
1000+ #: ../../faq/design.rst:675
9931001msgid ""
9941002"Python uses dynamic types. It is impossible to know in advance which "
9951003"attribute will be referenced at runtime. Member attributes may be added or "
@@ -999,11 +1007,11 @@ msgid ""
9991007msgstr ""
10001008"Python使用动态类型。事先不可能知道在运行时引用哪个属性。可以动态地在对象中添加或删除成员属性。这使得无法通过简单的阅读就知道引用的是什么属性:局部属性、全局属性还是成员属性?"
10011009
1002- #: ../../faq/design.rst:673
1010+ #: ../../faq/design.rst:681
10031011msgid "For instance, take the following incomplete snippet::"
10041012msgstr "例如,采用以下不完整的代码段::"
10051013
1006- #: ../../faq/design.rst:679
1014+ #: ../../faq/design.rst:687
10071015msgid ""
10081016"The snippet assumes that \" a\" must have a member attribute called \" x\" . "
10091017"However, there is nothing in Python that tells the interpreter this. What "
@@ -1014,89 +1022,89 @@ msgstr ""
10141022"该代码段假设 \" a\" 必须有一个名为 \" x\" 的成员属性。然而,Python中并没有告诉解释器这一点。假设 \" a\" "
10151023"是整数,会发生什么?如果有一个名为 \" x\" 的全局变量,它是否会在with块中使用?如您所见,Python的动态特性使得这样的选择更加困难。"
10161024
1017- #: ../../faq/design.rst:685
1025+ #: ../../faq/design.rst:693
10181026msgid ""
10191027"The primary benefit of \" with\" and similar language features (reduction of "
10201028"code volume) can, however, easily be achieved in Python by assignment. "
10211029"Instead of::"
10221030msgstr "然而,Python 可以通过赋值轻松实现 \" with\" 和类似语言特性(减少代码量)的主要好处。代替::"
10231031
1024- #: ../../faq/design.rst:692
1032+ #: ../../faq/design.rst:700
10251033msgid "write this::"
10261034msgstr "写成这样::"
10271035
1028- #: ../../faq/design.rst:699
1036+ #: ../../faq/design.rst:707
10291037msgid ""
10301038"This also has the side-effect of increasing execution speed because name "
10311039"bindings are resolved at run-time in Python, and the second version only "
10321040"needs to perform the resolution once."
10331041msgstr "这也具有提高执行速度的副作用,因为Python在运行时解析名称绑定,而第二个版本只需要执行一次解析。"
10341042
1035- #: ../../faq/design.rst:705
1043+ #: ../../faq/design.rst:713
10361044msgid "Why are colons required for the if/while/def/class statements?"
10371045msgstr "为什么 if/while/def/class语句需要冒号? "
10381046
1039- #: ../../faq/design.rst:707
1047+ #: ../../faq/design.rst:715
10401048msgid ""
10411049"The colon is required primarily to enhance readability (one of the results "
10421050"of the experimental ABC language). Consider this::"
10431051msgstr "冒号主要用于增强可读性(ABC语言实验的结果之一)。考虑一下这个::"
10441052
1045- #: ../../faq/design.rst:713
1053+ #: ../../faq/design.rst:721
10461054msgid "versus ::"
10471055msgstr "与 ::"
10481056
1049- #: ../../faq/design.rst:718
1057+ #: ../../faq/design.rst:726
10501058msgid ""
10511059"Notice how the second one is slightly easier to read. Notice further how a "
10521060"colon sets off the example in this FAQ answer; it's a standard usage in "
10531061"English."
10541062msgstr "注意第二种方法稍微容易一些。请进一步注意,在这个FAQ解答的示例中,冒号是如何设置的;这是英语中的标准用法。"
10551063
1056- #: ../../faq/design.rst:721
1064+ #: ../../faq/design.rst:729
10571065msgid ""
10581066"Another minor reason is that the colon makes it easier for editors with "
10591067"syntax highlighting; they can look for colons to decide when indentation "
10601068"needs to be increased instead of having to do a more elaborate parsing of "
10611069"the program text."
10621070msgstr "另一个次要原因是冒号使带有语法突出显示的编辑器更容易工作;他们可以寻找冒号来决定何时需要增加缩进,而不必对程序文本进行更精细的解析。"
10631071
1064- #: ../../faq/design.rst:727
1072+ #: ../../faq/design.rst:735
10651073msgid "Why does Python allow commas at the end of lists and tuples?"
10661074msgstr "为什么Python在列表和元组的末尾允许使用逗号?"
10671075
1068- #: ../../faq/design.rst:729
1076+ #: ../../faq/design.rst:737
10691077msgid ""
10701078"Python lets you add a trailing comma at the end of lists, tuples, and "
10711079"dictionaries::"
10721080msgstr "Python 允许您在列表,元组和字典的末尾添加一个尾随逗号::"
10731081
1074- #: ../../faq/design.rst:740
1082+ #: ../../faq/design.rst:748
10751083msgid "There are several reasons to allow this."
10761084msgstr "有几个理由允许这样做。"
10771085
1078- #: ../../faq/design.rst:742
1086+ #: ../../faq/design.rst:750
10791087msgid ""
10801088"When you have a literal value for a list, tuple, or dictionary spread across"
10811089" multiple lines, it's easier to add more elements because you don't have to "
10821090"remember to add a comma to the previous line. The lines can also be "
10831091"reordered without creating a syntax error."
10841092msgstr "如果列表,元组或字典的字面值分布在多行中,则更容易添加更多元素,因为不必记住在上一行中添加逗号。这些行也可以重新排序,而不会产生语法错误。"
10851093
1086- #: ../../faq/design.rst:747
1094+ #: ../../faq/design.rst:755
10871095msgid ""
10881096"Accidentally omitting the comma can lead to errors that are hard to "
10891097"diagnose. For example::"
10901098msgstr "不小心省略逗号会导致难以诊断的错误。例如::"
10911099
1092- #: ../../faq/design.rst:757
1100+ #: ../../faq/design.rst:765
10931101msgid ""
10941102"This list looks like it has four elements, but it actually contains three: "
10951103"\" fee\" , \" fiefoo\" and \" fum\" . Always adding the comma avoids this source"
10961104" of error."
10971105msgstr "这个列表看起来有四个元素,但实际上包含三个 : \" fee\" , \" fiefoo\" 和 \" fum\" 。总是加上逗号可以避免这个错误的来源。"
10981106
1099- #: ../../faq/design.rst:760
1107+ #: ../../faq/design.rst:768
11001108msgid ""
11011109"Allowing the trailing comma may also make programmatic code generation "
11021110"easier."
0 commit comments