3.14.5 AST Objects

AST objects returned by expr(), suite() and sequence2ast() have no methods of their own.

Ordered and equality comparisons are supported between AST objects. Pickling of AST objects (using the pickle module) is also supported.

ASTType
The type of the objects returned by expr(), suite() and sequence2ast().

AST objects have the following methods:

compile ([filename])
Same as compileast(ast, filename).

isexpr ()
Same as isexpr(ast).

issuite ()
Same as issuite(ast).

tolist ([line_info])
Same as ast2list(ast, line_info).

totuple ([line_info])
Same as ast2tuple(ast, line_info).