[IPython-dev] AST transformations - ready for review

Thomas Kluyver takowl at gmail.com
Sat Sep 29 05:22:17 EDT 2012

Hi all,

I think the AST transformation hook in PR #2301 is ready for review.

I've made sure that it works with %timeit, %time and macros. I've also
added a test for the Integer() wrapper that Sage and Sympy both want
to apply. The code for that is:

class IntegerWrapper(ast.NodeTransformer):
    """Wraps all integers in a call to Integer()"""
    def visit_Num(self, node):
        if isinstance(node.n, int):
            return ast.Call(func=ast.Name(id='Integer', ctx=ast.Load()),
                            args=[node], keywords=[])


More information about the IPython-dev mailing list