#7997: Use ast to replace display hook hack
-------------------------------------+--------------------------------------
Reporter: acleone | Owner: was
Type: enhancement | Status: new
Priority: major | Milestone:
Component: notebook | Keywords:
Author: Alex Leone, Tim Dumol | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------------------+--------------------------------------
See http://docs.python.org/library/ast.html#ast.NodeTransformer
Replace any Expr node in the ast tree with a function call to
{{{
def __print_if_not_none(expr):
if expr is not None:
print expr
}}}
An Expr node is anything like
{{{
123
do_foo()
for i in range(10):
i
}}}
Which will be replaced by
{{{
__print_if_not_none(123)
__print_if_not_none(do_foo())
for i in range(10):
__print_if_not_none(i)
}}}
Which will output
{{{
123
0
1
...
9
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7997>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.