, node, , node. node _fields, . ,
>>> ast.parse('5+a')
<_ast.Module object at 0x02C1F730>
>>> ast.parse('5+a').body
[<_ast.Expr object at 0x02C1FF50>]
>>> ast.parse('5+a').body[0]
<_ast.Expr object at 0x02C1FBF0>
>>> ast.parse('5+a').body[0]._fields
('value',)
>>> ast.parse('5+a').body[0].value
<_ast.BinOp object at 0x02C1FF90>
>>> ast.parse('5+a').body[0].value._fields
('left', 'op', 'right')
>>> ast.parse('5+a').body[0].value.left
<_ast.Num object at 0x02C1FB70>
..
, ,
, CPython
:
>>> type(ast.parse('5+a'))
<class '_ast.Module'>
, , . , , , .
>>> ast.parse('5+a')._fields
('body',)
>>> ast.parse('5+a').body
[<_ast.Expr object at 0x02E965B0>]
_fields AST - "", body - AST. , stmt, , Expr expr, value
>>> ast.parse('5+a').body[0].value
<_ast.BinOp object at 0x02E96330>
BinOp, , 3 , , . , .