Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit adb3472

Browse files
committed
[po] auto sync bot
1 parent a03b4f1 commit adb3472

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

faq/design.po

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
66
# Translators:
7-
# Yinuo Huang <[email protected]>, 2018
87
# ww song <[email protected]>, 2018
98
# Shengjing Zhu <[email protected]>, 2019
109
# Meng Du <[email protected]>, 2019
@@ -32,7 +31,7 @@ msgstr "设计和历史常见问题"
3231

3332
#: ../../faq/design.rst:6
3433
msgid "Contents"
35-
msgstr "内容"
34+
msgstr "目录"
3635

3736
#: ../../faq/design.rst:11
3837
msgid "Why does Python use indentation for grouping of statements?"
@@ -872,6 +871,8 @@ msgid ""
872871
"it and returns it. For example, here's how to iterate over the keys of a "
873872
"dictionary in sorted order::"
874873
msgstr ""
874+
"如果要返回新列表,请使用内置 :func:`sorted` "
875+
"函数。此函数从提供的可迭代列表中创建新列表,对其进行排序并返回。例如,下面是如何迭代遍历字典并按keys排序::"
875876

876877
#: ../../faq/design.rst:608
877878
msgid "How do you specify and enforce an interface spec in Python?"
@@ -883,7 +884,7 @@ msgid ""
883884
" and Java describes the prototypes for the methods and functions of the "
884885
"module. Many feel that compile-time enforcement of interface specifications"
885886
" helps in the construction of large programs."
886-
msgstr ""
887+
msgstr "由C++和Java等语言提供的模块接口规范描述了模块的方法和函数的原型。许多人认为接口规范的编译时强制执行有助于构建大型程序。"
887888

888889
#: ../../faq/design.rst:615
889890
msgid ""
@@ -894,13 +895,18 @@ msgid ""
894895
":class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and"
895896
" :class:`~collections.abc.MutableMapping`."
896897
msgstr ""
898+
"Python 2.6添加了一个 :mod:`abc` 模块,允许定义抽象基类 (ABCs)。然后可以使用 :func:`isinstance` 和 "
899+
":func:`issubclass` 来检查实例或类是否实现了特定的ABC。 :mod:`collections.abc` 模块定义了一组有用的ABCs"
900+
" 例如 :class:`~collections.abc.Iterable` , :class:`~collections.abc.Container`"
901+
" , 和 :class:`~collections.abc.MutableMapping` "
897902

898903
#: ../../faq/design.rst:622
899904
msgid ""
900905
"For Python, many of the advantages of interface specifications can be "
901906
"obtained by an appropriate test discipline for components. There is also a "
902907
"tool, PyChecker, which can be used to find problems due to subclassing."
903908
msgstr ""
909+
"对于Python,通过对组件进行适当的测试规程,可以获得接口规范的许多好处。还有一个工具PyChecker,可用于查找由于子类化引起的问题。"
904910

905911
#: ../../faq/design.rst:626
906912
msgid ""
@@ -913,6 +919,8 @@ msgid ""
913919
"can be used to construct exhaustive test suites that exercise every line of "
914920
"code in a module."
915921
msgstr ""
922+
"一个好的模块测试套件既可以提供回归测试,也可以作为模块接口规范和一组示例。许多Python模块可以作为脚本运行,以提供简单的“自我测试”。即使是使用复杂外部接口的模块,也常常可以使用外部接口的简单“桩代码(stub)”模拟进行隔离测试。可以使用"
923+
" :mod:`doctest` 和 :mod:`unittest` 模块或第三方测试框架来构造详尽的测试套件,以运行模块中的每一行代码。"
916924

917925
#: ../../faq/design.rst:634
918926
msgid ""
@@ -924,6 +932,9 @@ msgid ""
924932
"cannot test that your :meth:`append` implementation will actually do this "
925933
"correctly, but it's trivial to check this property in a test suite."
926934
msgstr ""
935+
"适当的测试规程可以帮助在Python中构建大型的、复杂的应用程序以及接口规范。事实上,它可能会更好,因为接口规范不能测试程序的某些属性。例如, "
936+
":meth:`append` 方法将向一些内部列表的末尾添加新元素;接口规范不能测试您的 :meth:`append` "
937+
"实现是否能够正确执行此操作,但是在测试套件中检查这个属性是很简单的。"
927938

928939
#: ../../faq/design.rst:642
929940
msgid ""
@@ -933,6 +944,7 @@ msgid ""
933944
" before you write any of the actual code. Of course Python allows you to be"
934945
" sloppy and not write test cases at all."
935946
msgstr ""
947+
"编写测试套件非常有用,您可能希望设计代码时着眼于使其易于测试。一种日益流行的技术是面向测试的开发,它要求在编写任何实际代码之前,首先编写测试套件的各个部分。当然,Python允许您草率行事,根本不编写测试用例。"
936948

937949
#: ../../faq/design.rst:650
938950
msgid "Why is there no goto?"
@@ -997,11 +1009,11 @@ msgid ""
9971009
"Python has a 'with' statement that wraps the execution of a block, calling "
9981010
"code on the entrance and exit from the block. Some language have a "
9991011
"construct that looks like this::"
1000-
msgstr ""
1012+
msgstr "Python有一个 'with' 语句,它封装了块的执行,在块的入口和出口调用代码。有些语言的结构是这样的::"
10011013

10021014
#: ../../faq/design.rst:708
10031015
msgid "In Python, such a construct would be ambiguous."
1004-
msgstr ""
1016+
msgstr "在Python中,这样的结构是不明确的。"
10051017

10061018
#: ../../faq/design.rst:710
10071019
msgid ""
@@ -1010,6 +1022,8 @@ msgid ""
10101022
"assigned to. This is the main point of static typing -- the compiler "
10111023
"*always* knows the scope of every variable at compile time."
10121024
msgstr ""
1025+
"其他语言,如ObjectPascal、Delphi和C++ 使用静态类型,因此可以毫不含糊地知道分配给什么成员。这是静态类型的要点 -- 编译器 "
1026+
"*总是* 在编译时知道每个变量的作用域。"
10131027

10141028
#: ../../faq/design.rst:715
10151029
msgid ""
@@ -1019,10 +1033,11 @@ msgid ""
10191033
"simple reading, what attribute is being referenced: a local one, a global "
10201034
"one, or a member attribute?"
10211035
msgstr ""
1036+
"Python使用动态类型。事先不可能知道在运行时引用哪个属性。可以动态地在对象中添加或删除成员属性。这使得无法通过简单的阅读就知道引用的是什么属性:局部属性、全局属性还是成员属性?"
10221037

10231038
#: ../../faq/design.rst:721
10241039
msgid "For instance, take the following incomplete snippet::"
1025-
msgstr ""
1040+
msgstr "例如,采用以下不完整的代码段::"
10261041

10271042
#: ../../faq/design.rst:727
10281043
msgid ""
@@ -1032,24 +1047,26 @@ msgid ""
10321047
"variable named \"x\", will it be used inside the with block? As you see, "
10331048
"the dynamic nature of Python makes such choices much harder."
10341049
msgstr ""
1050+
"该代码段假设 \"a\" 必须有一个名为 \"x\" 的成员属性。然而,Python中并没有告诉解释器这一点。假设 \"a\" "
1051+
"是整数,会发生什么?如果有一个名为 \"x\" 的全局变量,它是否会在with块中使用?如您所见,Python的动态特性使得这样的选择更加困难。"
10351052

10361053
#: ../../faq/design.rst:733
10371054
msgid ""
10381055
"The primary benefit of \"with\" and similar language features (reduction of "
10391056
"code volume) can, however, easily be achieved in Python by assignment. "
10401057
"Instead of::"
1041-
msgstr ""
1058+
msgstr "然而,Python 可以通过赋值轻松实现 \"with\" 和类似语言特性(减少代码量)的主要好处。代替::"
10421059

10431060
#: ../../faq/design.rst:740
10441061
msgid "write this::"
1045-
msgstr ""
1062+
msgstr "写成这样::"
10461063

10471064
#: ../../faq/design.rst:747
10481065
msgid ""
10491066
"This also has the side-effect of increasing execution speed because name "
10501067
"bindings are resolved at run-time in Python, and the second version only "
10511068
"needs to perform the resolution once."
1052-
msgstr ""
1069+
msgstr "这也具有提高执行速度的副作用,因为Python在运行时解析名称绑定,而第二个版本只需要执行一次解析。"
10531070

10541071
#: ../../faq/design.rst:753
10551072
msgid "Why are colons required for the if/while/def/class statements?"

0 commit comments

Comments
 (0)