[IPython-dev] Frontendbase and compile_ast.

Barry Wark barrywark@gmail....
Mon Sep 15 00:50:02 CDT 2008


Gael,

I will take a look at your branch as soon as I can this week. Just to
give you the reasoning behind compile_ast, at the time, Brian had
brought up the idea of passing around ASTs rather than strings to
represent code blocks in the IPython core and frontends. The advantage
would be that code transformations and modifications by the frontend
or by the controller before sending to the agents would be easier. I
thought that sounded swell and even started an aborted attempt to
change the core and frontends to using ASTs. Obviously, that
conversion from string -> AST hasn't happened and I didn't realize
that it introduced an incompatibility with 2.4. It's fine with me if
we remove it for now. I know you've worked very hard on the block
completion testing for your frontend, so I suggest we go with your
code for now.

-Barry

On Sun, Sep 14, 2008 at 3:11 PM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Sun, Sep 14, 2008 at 11:39:25PM +0200, Gael Varoquaux wrote:
>> Currently no code in the frontends uses this method. I used it for a
>> while, but it turned out that the codeop module was more suited for
>> testing if the code was complete than compiling it to ast. I am strongly
>> thinking about removing this method for know.
>
> OK, I went ahead and replaced the is_complete method to avoid using the
> compile_ast one. I stuck with the original behavior of not raise an
> exception when the code was not valid, but I think it would be a better
> behavior, as it allows to give feedback to the user on incorrect code.
> This is what I do in the linefrontendbase is_complete's method.
>
> Barry, what are your thoughts on that? You can take a peek at the new
> version of is_complete in my branch.
>
> Gaël
>


More information about the IPython-dev mailing list