@@ -1293,52 +1293,59 @@ msgstr ""
12931293msgid ""
12941294"Yield all direct child nodes of *node*, that is, all fields that are nodes "
12951295"and all items of fields that are lists of nodes."
1296- msgstr ""
1296+ msgstr "产生 *node* 所有的直接子节点,也就是说,所有为节点的字段所有为节点列表的字段条目。 "
12971297
12981298#: ../../library/ast.rst:2052
12991299msgid ""
13001300"Recursively yield all descendant nodes in the tree starting at *node* "
13011301"(including *node* itself), in no specified order. This is useful if you "
13021302"only want to modify nodes in place and don't care about the context."
13031303msgstr ""
1304+ "递归地产生节点树中从 *node* 开始(包括 *node* 本身)的所有下级节点,没有确定的排序方式。 "
1305+ "这在你仅想要原地修改节点而不关心具体上下文时很有用处。"
13041306
13051307#: ../../library/ast.rst:2059
13061308msgid ""
13071309"A node visitor base class that walks the abstract syntax tree and calls a "
13081310"visitor function for every node found. This function may return a value "
13091311"which is forwarded by the :meth:`visit` method."
13101312msgstr ""
1313+ "一个遍历抽象语法树并针对所找到的每个节点调用访问器函数的节点访问器基类。 该函数可能会返回一个由 :meth:`visit` 方法所提供的值。"
13111314
13121315#: ../../library/ast.rst:2063
13131316msgid ""
13141317"This class is meant to be subclassed, with the subclass adding visitor "
13151318"methods."
1316- msgstr ""
1319+ msgstr "这个类应当被子类化,并由子类来添加访问器方法。 "
13171320
13181321#: ../../library/ast.rst:2068
13191322msgid ""
13201323"Visit a node. The default implementation calls the method called "
13211324":samp:`self.visit_{classname}` where *classname* is the name of the node "
13221325"class, or :meth:`generic_visit` if that method doesn't exist."
13231326msgstr ""
1327+ "访问一个节点。 默认实现会调用名为 :samp:`self.visit_{classname}` 的方法其中 *classname* "
1328+ "为节点类的名称,或者如果该方法不存在则为 :meth:`generic_visit`。"
13241329
13251330#: ../../library/ast.rst:2074
13261331msgid "This visitor calls :meth:`visit` on all children of the node."
1327- msgstr ""
1332+ msgstr "该访问器会在节点的所有子节点上调用 :meth:`visit`。 "
13281333
13291334#: ../../library/ast.rst:2076
13301335msgid ""
13311336"Note that child nodes of nodes that have a custom visitor method won't be "
13321337"visited unless the visitor calls :meth:`generic_visit` or visits them "
13331338"itself."
1334- msgstr ""
1339+ msgstr "请注意所有包含自定义访问器方法的节点的子节点将不会被访问除非访问器调用了 :meth:`generic_visit` 或是自行访问它们。 "
13351340
13361341#: ../../library/ast.rst:2080
13371342msgid ""
13381343"Don't use the :class:`NodeVisitor` if you want to apply changes to nodes "
13391344"during traversal. For this a special visitor exists "
13401345"(:class:`NodeTransformer`) that allows modifications."
13411346msgstr ""
1347+ "如果你想在遍历期间应用对节点的修改则请不要使用 :class:`NodeVisitor`。 对此目的可使用一个允许修改的特殊访问器 "
1348+ "(:class:`NodeTransformer`)。"
13421349
13431350#: ../../library/ast.rst:2086
13441351msgid ""
@@ -1347,6 +1354,9 @@ msgid ""
13471354" will not be called in future Python versions. Add the "
13481355":meth:`visit_Constant` method to handle all constant nodes."
13491356msgstr ""
1357+ ":meth:`visit_Num`, :meth:`visit_Str`, :meth:`visit_Bytes`, "
1358+ ":meth:`visit_NameConstant` 和 :meth:`visit_Ellipsis` 等方法现在已被弃用且在未来的 Python "
1359+ "版本中将不会再被调用。 请添加 :meth:`visit_Constant` 方法来处理所有常量节点。"
13501360
13511361#: ../../library/ast.rst:2094
13521362msgid ""
@@ -1392,6 +1402,8 @@ msgid ""
13921402":attr:`lineno`), :func:`fix_missing_locations` should be called with the new"
13931403" sub-tree to recalculate the location information::"
13941404msgstr ""
1405+ "如果 :class:`NodeTransformer` 引入了新的(不属于原节点树一部分的)节点而没有给出它们的位置信息(如 "
1406+ ":attr:`lineno` 等),则应当调用 :func:`fix_missing_locations` 并传入新的子节点树来重新计算位置信息::"
13951407
13961408#: ../../library/ast.rst:2131
13971409msgid "Usually you use the transformer like this::"
0 commit comments