On Sun, Nov 3, 2013 at 11:39 AM, Volker Braun <[email protected]> wrote: > Manually parsing python code is spectacularly ugly and, as we saw, error > prone. The right way to do it is to use Python's own parser and then either > take apart the ast or use a NodeTransformer to insert the desired print > statements at the ends of if-bodies.
Unfortunately, the input isn't Python code, it's sage worksheet code, because of both the preparser and the % cell and line decorators. Fortunately, I think there's no insertion of actual print statements. Python has something called sys.displayhook, which gets called automatically when exec'ing. > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/groups/opt_out. -- William Stein Professor of Mathematics University of Washington http://wstein.org -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
