@@ -494,6 +494,9 @@ msgid ""
494494"following piece of code will print the value ``16``, without leaving a "
495495"trace::"
496496msgstr ""
497+ "*数据属性* 对应于 Smalltalk 中的“实例变量”,以及 C++ 中的“数据成员”。 "
498+ "数据属性不需要声明;像局部变量一样,它们将在第一次被赋值时产生。 例如,如果 ``x`` 是上面创建的 :class:`MyClass` "
499+ "的实例,则以下代码段将打印数值 ``16``,且不保留任何追踪信息::"
497500
498501#: ../../tutorial/classes.rst:340
499502msgid ""
@@ -505,6 +508,9 @@ msgid ""
505508"exclusively to mean methods of class instance objects, unless explicitly "
506509"stated otherwise.)"
507510msgstr ""
511+ "另一类实例属性引用称为 *方法*。 方法是“从属于”对象的函数。 (在 Python 中,方法这个术语并不是类实例所特有的:其他对方也可以有方法。 "
512+ "例如,列表对象具有 append, insert, remove, sort 等方法。 "
513+ "然而,在以下讨论中,我们使用方法一词将专指类实例对象的方法,除非另外显式地说明。)"
508514
509515#: ../../tutorial/classes.rst:349
510516msgid ""
@@ -515,14 +521,17 @@ msgid ""
515521"not, since ``MyClass.i`` is not. But ``x.f`` is not the same thing as "
516522"``MyClass.f`` --- it is a *method object*, not a function object."
517523msgstr ""
524+ "实例对象的有效方法名称依赖于其所属的类。 根据定义,一个类中所有是函数对象的属性都是定义了其实例的相应方法。 因此在我们的示例中,``x.f`` "
525+ "是有效的方法引用,因为 ``MyClass.f`` 是一个函数,而 ``x.i`` 不是方法,因为 ``MyClass.i`` 不是一个函数。 但是 "
526+ "``x.f`` 与 ``MyClass.f`` 并不是一回事 --- 它是一个 *方法对象*,不是函数对象。"
518527
519528#: ../../tutorial/classes.rst:360
520529msgid "Method Objects"
521530msgstr "方法对象"
522531
523532#: ../../tutorial/classes.rst:362
524533msgid "Usually, a method is called right after it is bound::"
525- msgstr "通常,方法在绑定后立即调用 ::"
534+ msgstr "通常,方法在绑定后立即被调用 ::"
526535
527536#: ../../tutorial/classes.rst:366
528537msgid ""
0 commit comments