@@ -15,7 +15,7 @@ msgid ""
1515msgstr ""
1616"Project-Id-Version : Python 3.8\n "
1717"Report-Msgid-Bugs-To : \n "
18- "POT-Creation-Date : 2020-02-09 12:40 +0000\n "
18+ "POT-Creation-Date : 2020-09-02 14:59 +0000\n "
1919"PO-Revision-Date : 2020-05-30 11:53+0000\n "
2020"
Last-Translator :
ppcfish <[email protected] >, 2020\n "
2121"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -866,12 +866,10 @@ msgstr ""
866866#: ../../faq/design.rst:573
867867msgid ""
868868"For Python, many of the advantages of interface specifications can be "
869- "obtained by an appropriate test discipline for components. There is also a "
870- "tool, PyChecker, which can be used to find problems due to subclassing."
869+ "obtained by an appropriate test discipline for components."
871870msgstr ""
872- "对于Python,通过对组件进行适当的测试规程,可以获得接口规范的许多好处。还有一个工具PyChecker,可用于查找由于子类化引起的问题。"
873871
874- #: ../../faq/design.rst:577
872+ #: ../../faq/design.rst:576
875873msgid ""
876874"A good test suite for a module can both provide a regression test and serve "
877875"as a module interface specification and a set of examples. Many Python "
@@ -885,7 +883,7 @@ msgstr ""
885883"一个好的模块测试套件既可以提供回归测试,也可以作为模块接口规范和一组示例。许多Python模块可以作为脚本运行,以提供简单的“自我测试”。即使是使用复杂外部接口的模块,也常常可以使用外部接口的简单“桩代码(stub)”模拟进行隔离测试。可以使用"
886884" :mod:`doctest` 和 :mod:`unittest` 模块或第三方测试框架来构造详尽的测试套件,以运行模块中的每一行代码。"
887885
888- #: ../../faq/design.rst:585
886+ #: ../../faq/design.rst:584
889887msgid ""
890888"An appropriate testing discipline can help build large complex applications "
891889"in Python as well as having interface specifications would. In fact, it can"
@@ -899,7 +897,7 @@ msgstr ""
899897":meth:`append` 方法将向一些内部列表的末尾添加新元素;接口规范不能测试您的 :meth:`append` "
900898"实现是否能够正确执行此操作,但是在测试套件中检查这个属性是很简单的。"
901899
902- #: ../../faq/design.rst:593
900+ #: ../../faq/design.rst:592
903901msgid ""
904902"Writing test suites is very helpful, and you might want to design your code "
905903"with an eye to making it easily tested. One increasingly popular technique,"
@@ -909,11 +907,11 @@ msgid ""
909907msgstr ""
910908"编写测试套件非常有用,您可能希望设计代码时着眼于使其易于测试。一种日益流行的技术是面向测试的开发,它要求在编写任何实际代码之前,首先编写测试套件的各个部分。当然,Python允许您草率行事,根本不编写测试用例。"
911909
912- #: ../../faq/design.rst:601
910+ #: ../../faq/design.rst:600
913911msgid "Why is there no goto?"
914912msgstr "为什么没有goto?"
915913
916- #: ../../faq/design.rst:603
914+ #: ../../faq/design.rst:602
917915msgid ""
918916"You can use exceptions to provide a \" structured goto\" that even works "
919917"across function calls. Many feel that exceptions can conveniently emulate "
@@ -923,24 +921,24 @@ msgstr ""
923921"可以使用异常捕获来提供 “goto结构” ,甚至可以跨函数调用工作的 。许多人认为异常捕获可以方便地模拟C,Fortran和其他语言的 \" go\" 或"
924922" \" goto\" 结构的所有合理用法。例如::"
925923
926- #: ../../faq/design.rst:618
924+ #: ../../faq/design.rst:617
927925msgid ""
928926"This doesn't allow you to jump into the middle of a loop, but that's usually"
929927" considered an abuse of goto anyway. Use sparingly."
930928msgstr "但是不允许你跳到循环的中间,这通常被认为是滥用goto。谨慎使用。"
931929
932- #: ../../faq/design.rst:623
930+ #: ../../faq/design.rst:622
933931msgid "Why can't raw strings (r-strings) end with a backslash?"
934932msgstr "为什么原始字符串(r-strings)不能以反斜杠结尾?"
935933
936- #: ../../faq/design.rst:625
934+ #: ../../faq/design.rst:624
937935msgid ""
938936"More precisely, they can't end with an odd number of backslashes: the "
939937"unpaired backslash at the end escapes the closing quote character, leaving "
940938"an unterminated string."
941939msgstr "更准确地说,它们不能以奇数个反斜杠结束:结尾处的不成对反斜杠会转义结束引号字符,留下未结束的字符串。"
942940
943- #: ../../faq/design.rst:629
941+ #: ../../faq/design.rst:628
944942msgid ""
945943"Raw strings were designed to ease creating input for processors (chiefly "
946944"regular expression engines) that want to do their own backslash escape "
@@ -952,33 +950,33 @@ msgstr ""
952950"原始字符串的设计是为了方便想要执行自己的反斜杠转义处理的处理器(主要是正则表达式引擎)创建输入。此类处理器将不匹配的尾随反斜杠视为错误,因此原始字符串不允许这样做。反过来,允许通过使用引号字符转义反斜杠转义字符串"
953951"。当r-string用于它们的预期目的时,这些规则工作的很好。"
954952
955- #: ../../faq/design.rst:636
953+ #: ../../faq/design.rst:635
956954msgid ""
957955"If you're trying to build Windows pathnames, note that all Windows system "
958956"calls accept forward slashes too::"
959957msgstr "如果您正在尝试构建Windows路径名,请注意所有Windows系统调用都使用正斜杠::"
960958
961- #: ../../faq/design.rst:641
959+ #: ../../faq/design.rst:640
962960msgid ""
963961"If you're trying to build a pathname for a DOS command, try e.g. one of ::"
964962msgstr "如果您正在尝试为DOS命令构建路径名,请尝试以下示例 ::"
965963
966- #: ../../faq/design.rst:649
964+ #: ../../faq/design.rst:648
967965msgid "Why doesn't Python have a \" with\" statement for attribute assignments?"
968966msgstr "为什么Python没有属性赋值的“with”语句?"
969967
970- #: ../../faq/design.rst:651
968+ #: ../../faq/design.rst:650
971969msgid ""
972970"Python has a 'with' statement that wraps the execution of a block, calling "
973971"code on the entrance and exit from the block. Some language have a "
974972"construct that looks like this::"
975973msgstr "Python有一个 'with' 语句,它封装了块的执行,在块的入口和出口调用代码。有些语言的结构是这样的::"
976974
977- #: ../../faq/design.rst:659
975+ #: ../../faq/design.rst:658
978976msgid "In Python, such a construct would be ambiguous."
979977msgstr "在Python中,这样的结构是不明确的。"
980978
981- #: ../../faq/design.rst:661
979+ #: ../../faq/design.rst:660
982980msgid ""
983981"Other languages, such as Object Pascal, Delphi, and C++, use static types, "
984982"so it's possible to know, in an unambiguous way, what member is being "
@@ -988,7 +986,7 @@ msgstr ""
988986"其他语言,如ObjectPascal、Delphi和C++ 使用静态类型,因此可以毫不含糊地知道分配给什么成员。这是静态类型的要点 -- 编译器 "
989987"*总是* 在编译时知道每个变量的作用域。"
990988
991- #: ../../faq/design.rst:666
989+ #: ../../faq/design.rst:665
992990msgid ""
993991"Python uses dynamic types. It is impossible to know in advance which "
994992"attribute will be referenced at runtime. Member attributes may be added or "
@@ -998,11 +996,11 @@ msgid ""
998996msgstr ""
999997"Python使用动态类型。事先不可能知道在运行时引用哪个属性。可以动态地在对象中添加或删除成员属性。这使得无法通过简单的阅读就知道引用的是什么属性:局部属性、全局属性还是成员属性?"
1000998
1001- #: ../../faq/design.rst:672
999+ #: ../../faq/design.rst:671
10021000msgid "For instance, take the following incomplete snippet::"
10031001msgstr "例如,采用以下不完整的代码段::"
10041002
1005- #: ../../faq/design.rst:678
1003+ #: ../../faq/design.rst:677
10061004msgid ""
10071005"The snippet assumes that \" a\" must have a member attribute called \" x\" . "
10081006"However, there is nothing in Python that tells the interpreter this. What "
@@ -1013,89 +1011,89 @@ msgstr ""
10131011"该代码段假设 \" a\" 必须有一个名为 \" x\" 的成员属性。然而,Python中并没有告诉解释器这一点。假设 \" a\" "
10141012"是整数,会发生什么?如果有一个名为 \" x\" 的全局变量,它是否会在with块中使用?如您所见,Python的动态特性使得这样的选择更加困难。"
10151013
1016- #: ../../faq/design.rst:684
1014+ #: ../../faq/design.rst:683
10171015msgid ""
10181016"The primary benefit of \" with\" and similar language features (reduction of "
10191017"code volume) can, however, easily be achieved in Python by assignment. "
10201018"Instead of::"
10211019msgstr "然而,Python 可以通过赋值轻松实现 \" with\" 和类似语言特性(减少代码量)的主要好处。代替::"
10221020
1023- #: ../../faq/design.rst:691
1021+ #: ../../faq/design.rst:690
10241022msgid "write this::"
10251023msgstr "写成这样::"
10261024
1027- #: ../../faq/design.rst:698
1025+ #: ../../faq/design.rst:697
10281026msgid ""
10291027"This also has the side-effect of increasing execution speed because name "
10301028"bindings are resolved at run-time in Python, and the second version only "
10311029"needs to perform the resolution once."
10321030msgstr "这也具有提高执行速度的副作用,因为Python在运行时解析名称绑定,而第二个版本只需要执行一次解析。"
10331031
1034- #: ../../faq/design.rst:704
1032+ #: ../../faq/design.rst:703
10351033msgid "Why are colons required for the if/while/def/class statements?"
10361034msgstr "为什么 if/while/def/class语句需要冒号? "
10371035
1038- #: ../../faq/design.rst:706
1036+ #: ../../faq/design.rst:705
10391037msgid ""
10401038"The colon is required primarily to enhance readability (one of the results "
10411039"of the experimental ABC language). Consider this::"
10421040msgstr "冒号主要用于增强可读性(ABC语言实验的结果之一)。考虑一下这个::"
10431041
1044- #: ../../faq/design.rst:712
1042+ #: ../../faq/design.rst:711
10451043msgid "versus ::"
10461044msgstr "与 ::"
10471045
1048- #: ../../faq/design.rst:717
1046+ #: ../../faq/design.rst:716
10491047msgid ""
10501048"Notice how the second one is slightly easier to read. Notice further how a "
10511049"colon sets off the example in this FAQ answer; it's a standard usage in "
10521050"English."
10531051msgstr "注意第二种方法稍微容易一些。请进一步注意,在这个FAQ解答的示例中,冒号是如何设置的;这是英语中的标准用法。"
10541052
1055- #: ../../faq/design.rst:720
1053+ #: ../../faq/design.rst:719
10561054msgid ""
10571055"Another minor reason is that the colon makes it easier for editors with "
10581056"syntax highlighting; they can look for colons to decide when indentation "
10591057"needs to be increased instead of having to do a more elaborate parsing of "
10601058"the program text."
10611059msgstr "另一个次要原因是冒号使带有语法突出显示的编辑器更容易工作;他们可以寻找冒号来决定何时需要增加缩进,而不必对程序文本进行更精细的解析。"
10621060
1063- #: ../../faq/design.rst:726
1061+ #: ../../faq/design.rst:725
10641062msgid "Why does Python allow commas at the end of lists and tuples?"
10651063msgstr "为什么Python在列表和元组的末尾允许使用逗号?"
10661064
1067- #: ../../faq/design.rst:728
1065+ #: ../../faq/design.rst:727
10681066msgid ""
10691067"Python lets you add a trailing comma at the end of lists, tuples, and "
10701068"dictionaries::"
10711069msgstr "Python 允许您在列表,元组和字典的末尾添加一个尾随逗号::"
10721070
1073- #: ../../faq/design.rst:739
1071+ #: ../../faq/design.rst:738
10741072msgid "There are several reasons to allow this."
10751073msgstr "有几个理由允许这样做。"
10761074
1077- #: ../../faq/design.rst:741
1075+ #: ../../faq/design.rst:740
10781076msgid ""
10791077"When you have a literal value for a list, tuple, or dictionary spread across"
10801078" multiple lines, it's easier to add more elements because you don't have to "
10811079"remember to add a comma to the previous line. The lines can also be "
10821080"reordered without creating a syntax error."
10831081msgstr "如果列表,元组或字典的字面值分布在多行中,则更容易添加更多元素,因为不必记住在上一行中添加逗号。这些行也可以重新排序,而不会产生语法错误。"
10841082
1085- #: ../../faq/design.rst:746
1083+ #: ../../faq/design.rst:745
10861084msgid ""
10871085"Accidentally omitting the comma can lead to errors that are hard to "
10881086"diagnose. For example::"
10891087msgstr "不小心省略逗号会导致难以诊断的错误。例如::"
10901088
1091- #: ../../faq/design.rst:756
1089+ #: ../../faq/design.rst:755
10921090msgid ""
10931091"This list looks like it has four elements, but it actually contains three: "
10941092"\" fee\" , \" fiefoo\" and \" fum\" . Always adding the comma avoids this source"
10951093" of error."
10961094msgstr "这个列表看起来有四个元素,但实际上包含三个 : \" fee\" , \" fiefoo\" 和 \" fum\" 。总是加上逗号可以避免这个错误的来源。"
10971095
1098- #: ../../faq/design.rst:759
1096+ #: ../../faq/design.rst:758
10991097msgid ""
11001098"Allowing the trailing comma may also make programmatic code generation "
11011099"easier."
0 commit comments