File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2715,10 +2715,12 @@ msgid ""
27152715"class methods, or through the implicit lexically scoped ``__class__`` "
27162716"reference described in the next section."
27172717msgstr ""
2718+ "但是,即使当类定义发生于函数内部时,在类内部定义的方法仍然无法看到在类作用域层次上定义的名称。类变量必须通过实例的第一个形参或类方法来访问,或者是通过下一节中描述的隐式词法作用域的"
2719+ " ``__class__`` 引用。"
27182720
27192721#: ../../reference/datamodel.rst:1947
27202722msgid "Creating the class object"
2721- msgstr ""
2723+ msgstr "创建类对象 "
27222724
27232725#: ../../reference/datamodel.rst:1954
27242726msgid ""
@@ -2727,6 +2729,8 @@ msgid ""
27272729"**kwds)`` (the additional keywords passed here are the same as those passed "
27282730"to ``__prepare__``)."
27292731msgstr ""
2732+ "一旦执行类主体完成填充类命名空间,将通过调用 ``metaclass(name, bases, namespace, **kwds)`` "
2733+ "创建类对象(此处的附加关键字参数与传入 ``__prepare__`` 的相同)。"
27302734
27312735#: ../../reference/datamodel.rst:1959
27322736msgid ""
@@ -2738,6 +2742,9 @@ msgid ""
27382742" scoping, while the class or instance that was used to make the current call"
27392743" is identified based on the first argument passed to the method."
27402744msgstr ""
2745+ "如果类主体中有任何方法引用了 ``__class__`` 或 ``super``,这个类对象会通过零参数形式的 :func:`super`. "
2746+ "``__class__`` 所引用,这是由编译器所创建的隐式闭包引用。这使用零参数形式的 :func:`super` "
2747+ "能够正确标识正在基于词法作用域来定义的类,而被用于进行当前调用的类或实例则是基于传递给方法的第一个参数来标识的。"
27412748
27422749#: ../../reference/datamodel.rst:1969
27432750msgid ""
You can’t perform that action at this time.
0 commit comments