module documentation

This is a stripped down version of Armin Ronacher's ast module.

Unknown Field: copyright
Copyright 2008 by Armin Ronacher.
Unknown Field: license
Python License.
Constant ALL​_SYMBOLS Undocumented
Constant BINOP​_SYMBOLS Undocumented
Constant BOOLOP​_SYMBOLS Undocumented
Constant CMPOP​_SYMBOLS Undocumented
Constant UNARYOP​_SYMBOLS Undocumented
Class ​Node​Transformer Walks the abstract syntax tree and allows modifications of nodes.
Class ​Node​Visitor Walks the abstract syntax tree and call visitor functions for every node found. The visitor functions may return values which will be forwarded by the visit method.
Class ​Source​Generator This visitor is able to transform a well formed syntax tree into python sourcecode. For more details have a look at the docstring of the node_to_source function.
Function iter​_fields Iterate over all fields of a node, only yielding existing fields.
Function parse Parse an expression into an AST node.
ALL_SYMBOLS: dict =

Undocumented

Value
{}
BINOP_SYMBOLS =

Undocumented

Value
{Add: '+',
 Sub: '-',
 Mult: '*',
 Div: '/',
 FloorDiv: '//',
 Mod: '%',
 LShift: '<<',
...
BOOLOP_SYMBOLS =

Undocumented

Value
{And: 'and', Or: 'or'}
CMPOP_SYMBOLS =

Undocumented

Value
{Eq: '==',
 Gt: '>',
 GtE: '>=',
 In: 'in',
 Is: 'is',
 IsNot: 'is not',
 Lt: '<',
...
UNARYOP_SYMBOLS =

Undocumented

Value
{Invert: '~', Not: 'not', UAdd: '+', USub: '-'}
def iter_fields(node):
Iterate over all fields of a node, only yielding existing fields.
def parse(expr, filename='<unknown>', mode='exec'):
Parse an expression into an AST node.