qnet.printing.treeprinting module

Tree printer for Expressions

This is mainly for interactive use.

Summary

Functions:

print_tree Print a tree representation of the structure of expr
tree Give the output of tree as a multiline string, using line drawings to visualize the hierarchy of expressions (similar to the tree unix command line program for showing directory trees)

Reference

qnet.printing.treeprinting.print_tree(expr, attr='operands', padding='', exclude_type=None, depth=None, unicode=True, srepr_leaves=False, _last=False, _root=True, _level=0, _print=True)[source]

Print a tree representation of the structure of expr

Parameters:
  • expr (Expression) – expression to render
  • attr (str) – The attribute from which to get the children of expr
  • padding (str) – Whitespace by which the entire tree is idented
  • exclude_type (type) – Type (or list of types) which should never be expanded recursively
  • depth (int or None) – Maximum depth of the tree to be printed
  • unicode (bool) – If True, use unicode line-drawing symbols for the tree, and print expressions in a unicode representation. If False, use an ASCII approximation.
  • srepr_leaves (bool) – Whether or not to render leaves with srepr, instead of ascii/unicode

See also

tree() return the result as a string, instead of printing it

qnet.printing.treeprinting.tree(expr, **kwargs)[source]

Give the output of tree as a multiline string, using line drawings to visualize the hierarchy of expressions (similar to the tree unix command line program for showing directory trees)

See also

qnet.printing.srepr() with indented=True produces a similar tree-like rendering of the given expression that can be re-evaluated to the original expression.