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

Skip to content

Commit e6abdce

Browse files
committed
[po] auto sync bot
1 parent fe509f5 commit e6abdce

1 file changed

Lines changed: 49 additions & 39 deletions

File tree

faq/programming.po

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ msgstr ""
11211121
msgid ""
11221122
"Is there an equivalent to Perl's chomp() for removing trailing newlines from"
11231123
" strings?"
1124-
msgstr ""
1124+
msgstr "是否有与Perl的chomp()等效的方法,用于从字符串中删除尾随换行符?"
11251125

11261126
#: ../../faq/programming.rst:982
11271127
msgid ""
@@ -1144,7 +1144,7 @@ msgstr ""
11441144

11451145
#: ../../faq/programming.rst:1001
11461146
msgid "Not as such."
1147-
msgstr ""
1147+
msgstr "不是这样的。"
11481148

11491149
#: ../../faq/programming.rst:1003
11501150
msgid ""
@@ -1164,7 +1164,7 @@ msgstr ""
11641164

11651165
#: ../../faq/programming.rst:1014
11661166
msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?"
1167-
msgstr ""
1167+
msgstr "'UnicodeDecodeError' 或 'UnicodeEncodeError' 错误是什么意思?"
11681168

11691169
#: ../../faq/programming.rst:1016
11701170
msgid "See the :ref:`unicode-howto`."
@@ -1485,12 +1485,12 @@ msgstr "如何将方法应用于一系列对象?"
14851485

14861486
#: ../../faq/programming.rst:1266
14871487
msgid "Use a list comprehension::"
1488-
msgstr ""
1488+
msgstr "使用列表理解:"
14891489

14901490
#: ../../faq/programming.rst:1273
14911491
msgid ""
14921492
"Why does a_tuple[i] += ['item'] raise an exception when the addition works?"
1493-
msgstr ""
1493+
msgstr "为什么在添加 _tuple[i]+=[‘item’] 时引发异常?"
14941494

14951495
#: ../../faq/programming.rst:1275
14961496
msgid ""
@@ -1508,7 +1508,7 @@ msgstr ""
15081508

15091509
#: ../../faq/programming.rst:1283
15101510
msgid "If you wrote::"
1511-
msgstr ""
1511+
msgstr "如果你写成:"
15121512

15131513
#: ../../faq/programming.rst:1291
15141514
msgid ""
@@ -1579,7 +1579,7 @@ msgstr ""
15791579
msgid ""
15801580
"I want to do a complicated sort: can you do a Schwartzian Transform in "
15811581
"Python?"
1582-
msgstr ""
1582+
msgstr "我想做一个复杂的排序:你能用Python做一个Schwartzian变换吗?"
15831583

15841584
#: ../../faq/programming.rst:1361
15851585
msgid ""
@@ -1588,6 +1588,8 @@ msgid ""
15881588
"value\". In Python, use the ``key`` argument for the :meth:`list.sort` "
15891589
"method::"
15901590
msgstr ""
1591+
"该技术归功于Perl社区的 Randal Schwartz,它通过将每个元素映射到其 \"排序值(sort value)\" "
1592+
"的度量对列表中的元素进行排序。在Python中,使用 :meth:`list.sort` 方法的 ``key`` 参数:"
15911593

15921594
#: ../../faq/programming.rst:1370
15931595
msgid "How can I sort one list by values from another list?"
@@ -1657,7 +1659,7 @@ msgstr "``方法`` 实际上就是类定义中的函数。对于某个对象 ``x
16571659

16581660
#: ../../faq/programming.rst:1431
16591661
msgid "What is self?"
1660-
msgstr "什么是self?"
1662+
msgstr "什么是 self ?"
16611663

16621664
#: ../../faq/programming.rst:1433
16631665
msgid ""
@@ -1837,33 +1839,33 @@ msgstr "如何在Python中重载构造函数(或方法)?"
18371839
msgid ""
18381840
"This answer actually applies to all methods, but the question usually comes "
18391841
"up first in the context of constructors."
1840-
msgstr ""
1842+
msgstr "这个答案实际上适用于所有方法,但问题通常首先出现在构造函数的上下文中。"
18411843

18421844
#: ../../faq/programming.rst:1610
18431845
msgid "In C++ you'd write"
1844-
msgstr ""
1846+
msgstr "在C ++中,你会这样写"
18451847

18461848
#: ../../faq/programming.rst:1619
18471849
msgid ""
18481850
"In Python you have to write a single constructor that catches all cases "
18491851
"using default arguments. For example::"
1850-
msgstr ""
1852+
msgstr "在Python中,您必须编写一个构造函数,使用默认参数捕获所有情况。例如:"
18511853

18521854
#: ../../faq/programming.rst:1629
18531855
msgid "This is not entirely equivalent, but close enough in practice."
1854-
msgstr ""
1856+
msgstr "这不完全等同,但在实践中足够接近。"
18551857

18561858
#: ../../faq/programming.rst:1631
18571859
msgid "You could also try a variable-length argument list, e.g. ::"
1858-
msgstr ""
1860+
msgstr "你也可以尝试一个可变长度的参数列表,例如::"
18591861

18601862
#: ../../faq/programming.rst:1636
18611863
msgid "The same approach works for all method definitions."
1862-
msgstr ""
1864+
msgstr "相同的方法适用于所有方法定义。"
18631865

18641866
#: ../../faq/programming.rst:1640
18651867
msgid "I try to use __spam and I get an error about _SomeClassName__spam."
1866-
msgstr ""
1868+
msgstr "我尝试使用 __spam ,但是得到一个关于 _SomeClassName__spam 的错误信息。"
18671869

18681870
#: ../../faq/programming.rst:1642
18691871
msgid ""
@@ -1886,7 +1888,7 @@ msgstr ""
18861888
#: ../../faq/programming.rst:1655
18871889
msgid ""
18881890
"My class defines __del__ but it is not called when I delete the object."
1889-
msgstr ""
1891+
msgstr "我的类定义了 __del__ 但是在删除对象时没有调用它。"
18901892

18911893
#: ../../faq/programming.rst:1657
18921894
msgid "There are several possible reasons for this."
@@ -1946,7 +1948,7 @@ msgid ""
19461948
"Python does not keep track of all instances of a class (or of a built-in "
19471949
"type). You can program the class's constructor to keep track of all "
19481950
"instances by keeping a list of weak references to each instance."
1949-
msgstr ""
1951+
msgstr "Python不跟踪类(或内置类型)的所有实例。您可以对类的构造函数进行编程,以通过保留每个实例的弱引用列表来跟踪所有实例。"
19501952

19511953
#: ../../faq/programming.rst:1707
19521954
msgid "Why does the result of ``id()`` appear to be not unique?"
@@ -1960,6 +1962,8 @@ msgid ""
19601962
"memory, the next freshly created object is allocated at the same position in"
19611963
" memory. This is illustrated by this example:"
19621964
msgstr ""
1965+
":func:`id` "
1966+
"返回一个整数,该整数在对象的生命周期内保证是唯一的。因为在CPython中,这是对象的内存地址,所以经常发生在从内存中删除对象之后,下一个新创建的对象被分配在内存中的相同位置。这个例子说明了这一点:"
19631967

19641968
#: ../../faq/programming.rst:1720
19651969
msgid ""
@@ -1968,14 +1972,15 @@ msgid ""
19681972
"objects whose id you want to examine are still alive, create another "
19691973
"reference to the object:"
19701974
msgstr ""
1975+
"这两个id属于之前创建的不同整数对象,并在执行 ``id()`` 调用后立即删除。要确保要检查其id的对象仍处于活动状态,请创建对该对象的另一个引用:"
19711976

19721977
#: ../../faq/programming.rst:1733
19731978
msgid "Modules"
19741979
msgstr "模块"
19751980

19761981
#: ../../faq/programming.rst:1736
19771982
msgid "How do I create a .pyc file?"
1978-
msgstr "怎么创建.pyc文件?"
1983+
msgstr "如何创建 .pyc 文件?"
19791984

19801985
#: ../../faq/programming.rst:1738
19811986
msgid ""
@@ -2057,10 +2062,12 @@ msgid ""
20572062
"importing them also provide a command-line interface or a self-test, and "
20582063
"only execute this code after checking ``__name__``::"
20592064
msgstr ""
2065+
"模块可以通过查看预定义的全局变量 ``__name__`` 找到自己的模块名称。如果它的值为 ``'__main__'`` "
2066+
",程序将作为脚本运行。通常,通过导入使用的许多模块也提供命令行界面或自检,并且只在检查 ``__name__`` 之后,才执行之后的代码::"
20602067

20612068
#: ../../faq/programming.rst:1803
20622069
msgid "How can I have modules that mutually import each other?"
2063-
msgstr "怎样才能拥有相互导入的模块?"
2070+
msgstr "如何让模块相互导入?"
20642071

20652072
#: ../../faq/programming.rst:1805
20662073
msgid "Suppose you have the following modules:"
@@ -2076,56 +2083,56 @@ msgstr "bar.py::"
20762083

20772084
#: ../../faq/programming.rst:1817
20782085
msgid "The problem is that the interpreter will perform the following steps:"
2079-
msgstr ""
2086+
msgstr "问题是解释器将执行以下步骤:"
20802087

20812088
#: ../../faq/programming.rst:1819
20822089
msgid "main imports foo"
2083-
msgstr ""
2090+
msgstr "首先导入foo"
20842091

20852092
#: ../../faq/programming.rst:1820
20862093
msgid "Empty globals for foo are created"
2087-
msgstr ""
2094+
msgstr "创建用于foo的空全局变量"
20882095

20892096
#: ../../faq/programming.rst:1821
20902097
msgid "foo is compiled and starts executing"
2091-
msgstr ""
2098+
msgstr "foo被编译并开始执行"
20922099

20932100
#: ../../faq/programming.rst:1822
20942101
msgid "foo imports bar"
2095-
msgstr ""
2102+
msgstr "foo 导入 bar"
20962103

20972104
#: ../../faq/programming.rst:1823
20982105
msgid "Empty globals for bar are created"
2099-
msgstr ""
2106+
msgstr "创建了用于bar 的空全局变量"
21002107

21012108
#: ../../faq/programming.rst:1824
21022109
msgid "bar is compiled and starts executing"
2103-
msgstr ""
2110+
msgstr "bar被编译并开始执行"
21042111

21052112
#: ../../faq/programming.rst:1825
21062113
msgid ""
21072114
"bar imports foo (which is a no-op since there already is a module named foo)"
2108-
msgstr ""
2115+
msgstr "bar导入foo(这是一个空操作(no-op ),因为已经有一个名为foo的模块)"
21092116

21102117
#: ../../faq/programming.rst:1826
21112118
msgid "bar.foo_var = foo.foo_var"
2112-
msgstr ""
2119+
msgstr "bar.foo_var = foo.foo_var"
21132120

21142121
#: ../../faq/programming.rst:1828
21152122
msgid ""
21162123
"The last step fails, because Python isn't done with interpreting ``foo`` yet"
21172124
" and the global symbol dictionary for ``foo`` is still empty."
2118-
msgstr ""
2125+
msgstr "最后一步失败了,因为Python还没有解释foo,而foo的全局符号字典仍然是空的。"
21192126

21202127
#: ../../faq/programming.rst:1831
21212128
msgid ""
21222129
"The same thing happens when you use ``import foo``, and then try to access "
21232130
"``foo.foo_var`` in global code."
2124-
msgstr ""
2131+
msgstr "当你使用 ``import foo`` ,然后尝试在全局代码中访问 ``foo.foo_var`` 时,会发生同样的事情。"
21252132

21262133
#: ../../faq/programming.rst:1834
21272134
msgid "There are (at least) three possible workarounds for this problem."
2128-
msgstr ""
2135+
msgstr "这个问题有(至少)三种可能的解决方法。"
21292136

21302137
#: ../../faq/programming.rst:1836
21312138
msgid ""
@@ -2135,6 +2142,9 @@ msgid ""
21352142
"only. This means everything from an imported module is referenced as "
21362143
"``<module>.<name>``."
21372144
msgstr ""
2145+
"Guido van Rossum 建议避免使用 ``from <module> import ...`` "
2146+
",并将所有代码放在函数中。全局变量和类变量的初始化只能使用常量或内置函数。这意味着导入模块中的所有内容都被引用为 ``<module>.<name>``"
2147+
" 。"
21382148

21392149
#: ../../faq/programming.rst:1841
21402150
msgid ""
@@ -2145,42 +2155,42 @@ msgstr "Jim Roskind建议在每个模块中按以下顺序执行步骤:"
21452155
msgid ""
21462156
"exports (globals, functions, and classes that don't need imported base "
21472157
"classes)"
2148-
msgstr "exports(全局变量,函数和不需要导入基类的类)"
2158+
msgstr "导出(全局变量,函数和不需要导入基类的类)"
21492159

21502160
#: ../../faq/programming.rst:1845
21512161
msgid "``import`` statements"
2152-
msgstr ""
2162+
msgstr "``导入`` 声明"
21532163

21542164
#: ../../faq/programming.rst:1846
21552165
msgid ""
21562166
"active code (including globals that are initialized from imported values)."
2157-
msgstr ""
2167+
msgstr "活动代码(包括从导入值初始化的全局变量)。"
21582168

21592169
#: ../../faq/programming.rst:1848
21602170
msgid ""
21612171
"van Rossum doesn't like this approach much because the imports appear in a "
21622172
"strange place, but it does work."
2163-
msgstr ""
2173+
msgstr "van Rossum不喜欢这种方法,因为导入出现在一个陌生的地方,但这种方法确实有效。"
21642174

21652175
#: ../../faq/programming.rst:1851
21662176
msgid ""
21672177
"Matthias Urlichs recommends restructuring your code so that the recursive "
21682178
"import is not necessary in the first place."
2169-
msgstr ""
2179+
msgstr "Matthias Urlichs建议重构代码,以便首先不需要递归导入。"
21702180

21712181
#: ../../faq/programming.rst:1854
21722182
msgid "These solutions are not mutually exclusive."
2173-
msgstr ""
2183+
msgstr "这些解决方案并不相互排斥。"
21742184

21752185
#: ../../faq/programming.rst:1858
21762186
msgid "__import__('x.y.z') returns <module 'x'>; how do I get z?"
2177-
msgstr "__import__('x.y.z') returns <module 'x'>; 如何获取z?"
2187+
msgstr "__import__('x.y.z') 返回 <module 'x'>; 如何获取z?"
21782188

21792189
#: ../../faq/programming.rst:1860
21802190
msgid ""
21812191
"Consider using the convenience function :func:`~importlib.import_module` "
21822192
"from :mod:`importlib` instead::"
2183-
msgstr ""
2193+
msgstr "考虑使用 :mod:`importlib` 中的函数 :func:`~importlib.import_module` :"
21842194

21852195
#: ../../faq/programming.rst:1867
21862196
msgid ""

0 commit comments

Comments
 (0)