1111# ChenYuan <[email protected] >, 20191212# Siyuan Xu <[email protected] >, 20191313# Meng Du <[email protected] >, 201914- # ppcfish <[email protected] >, 20191514# Freesand Leo <[email protected] >, 201915+ # ppcfish <[email protected] >, 20191616#
1717#, fuzzy
1818msgid ""
@@ -21,7 +21,7 @@ msgstr ""
2121"Report-Msgid-Bugs-To : \n "
2222"POT-Creation-Date : 2019-05-14 11:26+0900\n "
2323"PO-Revision-Date : 2017-02-16 17:43+0000\n "
24- "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2019\n "
24+ "Last-Translator : ppcfish <ppcfish@gmail .com>, 2019\n "
2525"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2626"MIME-Version : 1.0\n "
2727"Content-Type : text/plain; charset=UTF-8\n "
@@ -966,17 +966,19 @@ msgstr ""
966966
967967#: ../../faq/programming.rst:741
968968msgid "Is it possible to write obfuscated one-liners in Python?"
969- msgstr ""
969+ msgstr "是否可以用Python编写混淆的单行程序? "
970970
971971#: ../../faq/programming.rst:743
972972msgid ""
973973"Yes. Usually this is done by nesting :keyword:`lambda` within "
974974":keyword:`!lambda`. See the following three examples, due to Ulf Bartelt::"
975975msgstr ""
976+ "可以。通常是通过在 :keyword:`lambda` 中嵌套 :keyword:`!lambda` 来实现的。请参阅以下三个来自Ulf "
977+ "Bartelt的示例代码:"
976978
977979#: ../../faq/programming.rst:770
978980msgid "Don't try this at home, kids!"
979- msgstr ""
981+ msgstr "请不要在家里尝试,骚年! "
980982
981983#: ../../faq/programming.rst:776
982984msgid "What does the slash(/) in the parameter list of a function mean?"
@@ -1174,12 +1176,14 @@ msgid ""
11741176" empty lines at the end, the line terminators for all the blank lines will "
11751177"be removed::"
11761178msgstr ""
1179+ "可以使用 ``S.rstrip(\"\\ r\\ n\" )`` 从字符串 ``S`` 的末尾删除所有的换行符,而不删除其他尾随空格。如果字符串 ``S`` "
1180+ "表示多行,且末尾有几个空行,则将删除所有空行的换行符:"
11771181
11781182#: ../../faq/programming.rst:994
11791183msgid ""
11801184"Since this is typically only desired when reading text one line at a time, "
11811185"using ``S.rstrip()`` this way works well."
1182- msgstr ""
1186+ msgstr "由于通常只在一次读取一行文本时才需要这样做,所以使用 ``S.rstrip()`` 这种方式工作得很好。 "
11831187
11841188#: ../../faq/programming.rst:999
11851189msgid "Is there a scanf() or sscanf() equivalent?"
@@ -1954,7 +1958,7 @@ msgstr ""
19541958#: ../../faq/programming.rst:1655
19551959msgid ""
19561960"My class defines __del__ but it is not called when I delete the object."
1957- msgstr "我的类定义了 __del__ 但是在删除对象时没有调用它 。"
1961+ msgstr "类定义了 __del__ 方法,但是删除对象时没有调用它 。"
19581962
19591963#: ../../faq/programming.rst:1657
19601964msgid "There are several possible reasons for this."
@@ -1966,6 +1970,8 @@ msgid ""
19661970"decrements the object's reference count, and if this reaches zero "
19671971":meth:`__del__` is called."
19681972msgstr ""
1973+ "del 语句不一定调用 :meth:`__del__` —— 它只是减少对象的引用计数,如果(引用计数)达到零,才会调用:meth:`__del__` "
1974+ "。"
19691975
19701976#: ../../faq/programming.rst:1663
19711977msgid ""
@@ -1980,6 +1986,10 @@ msgid ""
19801986"You can run :func:`gc.collect` to force a collection, but there *are* "
19811987"pathological cases where objects will never be collected."
19821988msgstr ""
1989+ "如果数据结构包含循环链接(例如,每个子级都有一个父级引用,每个父级都有一个子级列表的树),则引用计数将永远不会返回零。尽管Python "
1990+ "偶尔会运行一个算法来检测这样的循环,但在数据结构的最后一次引用计数清零后,垃圾收集器可能需要一段时间来运行,因此您的 :meth:`__del__` "
1991+ "方法可能会在不方便和随机的时间被调用。这对于重现一个问题,是非常不方便的。更糟糕的是,对象 :meth:`__del__` "
1992+ "的方法执行顺序是任意的。你可以运行 :func:`gc.collect` 来强制回收,但在一些病态的情况下,对象永远不会被回收。"
19831993
19841994#: ../../faq/programming.rst:1674
19851995msgid ""
@@ -1990,6 +2000,9 @@ msgid ""
19902000"``close()`` and ``close()`` should make sure that it can be called more than"
19912001" once for the same object."
19922002msgstr ""
2003+ "尽管使用了循环收集器,但是在对象上定义一个显式 ``close()`` 方法仍然是一个好主意,无论何时使用完这些对象都可以调用它。然后, "
2004+ "``close()`` 方法可以删除引用子对象的属性。不要直接调用 :meth:`__del__` 应该调用 ``close()`` , "
2005+ "``close()`` 能确保同一对象可以多次调用它。"
19932006
19942007#: ../../faq/programming.rst:1681
19952008msgid ""
@@ -1998,12 +2011,14 @@ msgid ""
19982011"reference count. Tree data structures, for instance, should use weak "
19992012"references for their parent and sibling references (if they need them!)."
20002013msgstr ""
2014+ "另一种避免循环引用的方法是使用 :mod:`weakref` "
2015+ "模块,该模块允许您指向对象而不增加其引用计数。例如,树状数据结构应该对其父级和同级引用使用弱引用(如果需要的话!)"
20012016
20022017#: ../../faq/programming.rst:1694
20032018msgid ""
20042019"Finally, if your :meth:`__del__` method raises an exception, a warning "
20052020"message is printed to :data:`sys.stderr`."
2006- msgstr ""
2021+ msgstr "最后,如果 :meth:`__del__` 方法引发异常,会将警告消息打印到 :data:`sys.stderr` 。 "
20072022
20082023#: ../../faq/programming.rst:1699
20092024msgid "How do I get a list of all instances of a given class?"
0 commit comments