@@ -797,35 +797,37 @@ msgid ""
797797"returns a function ``f(x)`` that computes the value ``a*x+b``. Using nested"
798798" scopes::"
799799msgstr ""
800+ "你有两种选择:使用嵌套作用域,或者使用可调用对象。 例如,假设你想要定义 ``linear(a,b)`` 使其返回一个函数 ``f(x)`` 来设计 "
801+ "``a*x+b`` 的值。 可以使用以下嵌套作用域::"
800802
801803#: ../../faq/programming.rst:587
802804msgid "Or using a callable object::"
803- msgstr ""
805+ msgstr "或使用一个可调用对象:: "
804806
805807#: ../../faq/programming.rst:597
806808msgid "In both cases, ::"
807- msgstr ""
809+ msgstr "在两种情况下,:: "
808810
809811#: ../../faq/programming.rst:601
810812msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``."
811- msgstr ""
813+ msgstr "都会给出一个可调用对象,使得 ``taxes(10e6) == 0.3 * 10e6 + 2``. "
812814
813815#: ../../faq/programming.rst:603
814816msgid ""
815817"The callable object approach has the disadvantage that it is a bit slower "
816818"and results in slightly longer code. However, note that a collection of "
817819"callables can share their signature via inheritance::"
818- msgstr ""
820+ msgstr "可调用对象方式的缺点是速度略慢且生成的代码略长。 但是,请注意一组可调用对象能够通过继承来共享签名:: "
819821
820822#: ../../faq/programming.rst:612
821823msgid "Object can encapsulate state for several methods::"
822- msgstr ""
824+ msgstr "对象可以封装多个方法的状态:: "
823825
824826#: ../../faq/programming.rst:630
825827msgid ""
826828"Here ``inc()``, ``dec()`` and ``reset()`` act like functions which share the"
827829" same counting variable."
828- msgstr ""
830+ msgstr "这里 ``inc()``, ``dec()`` 和 ``reset()`` 将表现为共享同一计数变量的多个函数。 "
829831
830832#: ../../faq/programming.rst:635
831833msgid "How do I copy an object in Python?"
@@ -836,16 +838,18 @@ msgid ""
836838"In general, try :func:`copy.copy` or :func:`copy.deepcopy` for the general "
837839"case. Not all objects can be copied, but most can."
838840msgstr ""
841+ "一般来说,通常情况下请尝试 :func:`copy.copy` 或 :func:`copy.deepcopy`。 "
842+ "不是所有对象都可以复制,但多数都是可以的。"
839843
840844#: ../../faq/programming.rst:640
841845msgid ""
842846"Some objects can be copied more easily. Dictionaries have a "
843847":meth:`~dict.copy` method::"
844- msgstr ""
848+ msgstr "某些对象可以方便地复制。 例如字典具有 :meth:`~dict.copy` 方法:: "
845849
846850#: ../../faq/programming.rst:645
847851msgid "Sequences can be copied by slicing::"
848- msgstr ""
852+ msgstr "序列可以通过切片来复制:: "
849853
850854#: ../../faq/programming.rst:651
851855msgid "How can I find the methods or attributes of an object?"
@@ -856,7 +860,7 @@ msgid ""
856860"For an instance x of a user-defined class, ``dir(x)`` returns an "
857861"alphabetized list of the names containing the instance attributes and "
858862"methods and attributes defined by its class."
859- msgstr ""
863+ msgstr "对于一个用户自定义类的实例 x,``dir(x)`` 将返回一个按字母顺序排序的包含实例属性和方法及其类所定义的属性名称的列表。 "
860864
861865#: ../../faq/programming.rst:659
862866msgid "How can my code discover the name of an object?"
@@ -869,6 +873,8 @@ msgid ""
869873"``def`` and ``class`` statements, but in that case the value is a callable. "
870874"Consider the following code::"
871875msgstr ""
876+ "通常来说是做不到的,因为对象并不真正具有名称。 在本质上,赋值总是会将一个名称绑定到某个值;``def`` 和 ``class`` "
877+ "语句也是如此,但在此情况下该值是一个可调用对象。 考虑以下代码::"
872878
873879#: ../../faq/programming.rst:677
874880msgid ""
0 commit comments