#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: |
-------------------------------------+--------------------------------------
Comment(by acleone):
Ok, you should probably work on this. I think this patch should just
change the way `%sage`/`%python` is executed:
1. Preparse to valid python
1. Save to a file.
* Not base64 encoded, etc, just straight the straight unicode text
after Preparsing
* (So the file matches the cell exactly except for preparsing)
1. Parse the source into an ast
* syntax errors are caught here
1. Unless `%no_print_exprs` or something, add in `print_if_not_none`
calls with the `ast.NodeTransformer` for any `Expr` nodes that aren't in
function def's.
1. exec the ast tree, with globals set to a dictionary built from all
previously evaluated cells and sage globals
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7997#comment:2>
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.