(node, annotate_fields=True, include_attributes=False)
return _format(node)
Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
Return a formatted dump of the tree in * node * . This is mainly useful for debugging purposes . The returned string will show the names and the values for fields . This makes the code impossible to evaluate so if evaluation is wanted * annotate_fields * must be set to False . Attributes such as line numbers and column offsets are not dumped by default . If this is wanted * include_attributes * can be set to True .
def dump(node, annotate_fields=True, include_attributes=False):
    """
    Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
    """
    def _format(node):
        if isinstance(node, AST):
            fields = [(a, _format(b)) for a, b in iter_fields(node)]
            rv = '%s(%s' % (node.__class__.__name__, ', '.join(
                ('%s=%s' % field for field in fields)
                if annotate_fields else
                (b for a, b in fields)
            ))
            if include_attributes and node._attributes:
                rv += fields and ', ' or ' '
                rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))
                                for a in node._attributes)
            return rv + ')'
        elif isinstance(node, list):
            return '[%s]' % ', '.join(_format(x) for x in node)
        return repr(node)
    if not isinstance(node, AST):
        raise TypeError('expected AST, got %r' % node.__class__.__name__)
    return _format(node)
def dump ( node , annotate_fields = True , include_attributes = False ) : def _format ( node ) : if isinstance ( node , AST ) : fields = [ ( a , _format ( b ) ) for a , b in iter_fields ( node ) ] rv = '%s(%s' % ( node . __class__ . __name__ , ', ' . join ( ( '%s=%s' % field for field in fields ) if annotate_fields else ( b for a , b in fields ) ) ) if include_attributes and node . _attributes : rv += fields and ', ' or ' ' rv += ', ' . join ( '%s=%s' % ( a , _format ( getattr ( node , a ) ) ) for a in node . _attributes ) return rv + ')' elif isinstance ( node , list ) : return '[%s]' % ', ' . join ( _format ( x ) for x in node ) return repr ( node ) if not isinstance ( node , AST ) : raise TypeError ( 'expected AST, got %r' % node . __class__ . __name__ ) return _format ( node )