@@ -1093,52 +1093,59 @@ msgstr ""
10931093msgid ""
10941094"Yield all direct child nodes of *node*, that is, all fields that are nodes "
10951095"and all items of fields that are lists of nodes."
1096- msgstr ""
1096+ msgstr "产生 *node* 所有的直接子节点,也就是说,所有为节点的字段所有为节点列表的字段条目。 "
10971097
10981098#: ../../library/ast.rst:1664
10991099msgid ""
11001100"Recursively yield all descendant nodes in the tree starting at *node* "
11011101"(including *node* itself), in no specified order. This is useful if you "
11021102"only want to modify nodes in place and don't care about the context."
11031103msgstr ""
1104+ "递归地产生节点树中从 *node* 开始(包括 *node* 本身)的所有下级节点,没有确定的排序方式。 "
1105+ "这在你仅想要原地修改节点而不关心具体上下文时很有用处。"
11041106
11051107#: ../../library/ast.rst:1671
11061108msgid ""
11071109"A node visitor base class that walks the abstract syntax tree and calls a "
11081110"visitor function for every node found. This function may return a value "
11091111"which is forwarded by the :meth:`visit` method."
11101112msgstr ""
1113+ "一个遍历抽象语法树并针对所找到的每个节点调用访问器函数的节点访问器基类。 该函数可能会返回一个由 :meth:`visit` 方法所提供的值。"
11111114
11121115#: ../../library/ast.rst:1675
11131116msgid ""
11141117"This class is meant to be subclassed, with the subclass adding visitor "
11151118"methods."
1116- msgstr ""
1119+ msgstr "这个类应当被子类化,并由子类来添加访问器方法。 "
11171120
11181121#: ../../library/ast.rst:1680
11191122msgid ""
11201123"Visit a node. The default implementation calls the method called "
11211124":samp:`self.visit_{classname}` where *classname* is the name of the node "
11221125"class, or :meth:`generic_visit` if that method doesn't exist."
11231126msgstr ""
1127+ "访问一个节点。 默认实现会调用名为 :samp:`self.visit_{classname}` 的方法其中 *classname* "
1128+ "为节点类的名称,或者如果该方法不存在则为 :meth:`generic_visit`。"
11241129
11251130#: ../../library/ast.rst:1686
11261131msgid "This visitor calls :meth:`visit` on all children of the node."
1127- msgstr ""
1132+ msgstr "该访问器会在节点的所有子节点上调用 :meth:`visit`。 "
11281133
11291134#: ../../library/ast.rst:1688
11301135msgid ""
11311136"Note that child nodes of nodes that have a custom visitor method won't be "
11321137"visited unless the visitor calls :meth:`generic_visit` or visits them "
11331138"itself."
1134- msgstr ""
1139+ msgstr "请注意所有包含自定义访问器方法的节点的子节点将不会被访问除非访问器调用了 :meth:`generic_visit` 或是自行访问它们。 "
11351140
11361141#: ../../library/ast.rst:1692
11371142msgid ""
11381143"Don't use the :class:`NodeVisitor` if you want to apply changes to nodes "
11391144"during traversal. For this a special visitor exists "
11401145"(:class:`NodeTransformer`) that allows modifications."
11411146msgstr ""
1147+ "如果你想在遍历期间应用对节点的修改则请不要使用 :class:`NodeVisitor`。 对此目的可使用一个允许修改的特殊访问器 "
1148+ "(:class:`NodeTransformer`)。"
11421149
11431150#: ../../library/ast.rst:1698
11441151msgid ""
@@ -1147,6 +1154,9 @@ msgid ""
11471154" will not be called in future Python versions. Add the "
11481155":meth:`visit_Constant` method to handle all constant nodes."
11491156msgstr ""
1157+ ":meth:`visit_Num`, :meth:`visit_Str`, :meth:`visit_Bytes`, "
1158+ ":meth:`visit_NameConstant` 和 :meth:`visit_Ellipsis` 等方法现在已被弃用且在未来的 Python "
1159+ "版本中将不会再被调用。 请添加 :meth:`visit_Constant` 方法来处理所有常量节点。"
11501160
11511161#: ../../library/ast.rst:1706
11521162msgid ""
@@ -1192,6 +1202,8 @@ msgid ""
11921202":attr:`lineno`), :func:`fix_missing_locations` should be called with the new"
11931203" sub-tree to recalculate the location information::"
11941204msgstr ""
1205+ "如果 :class:`NodeTransformer` 引入了新的(不属于原节点树一部分的)节点而没有给出它们的位置信息(如 "
1206+ ":attr:`lineno` 等),则应当调用 :func:`fix_missing_locations` 并传入新的子节点树来重新计算位置信息::"
11951207
11961208#: ../../library/ast.rst:1743
11971209msgid "Usually you use the transformer like this::"
0 commit comments