[IPython-dev] Raising a SyntaxError in InputTransformer

Thomas Kluyver takowl at gmail.com
Fri Aug 9 12:36:25 EDT 2013


On 9 August 2013 08:07, Volker Braun <vbraun.name at gmail.com> wrote:

> Now if there are unbalanced brackets ("QQ[}") then we would like to tell
> the
> user that, but right now any exceptions raised by the input transformer
> will
> not be caught and terminate IPython. I think it would be easy to patch
> IPython to catch SyntaxErrors from the input transformers, but then I was
> hoping that the developers would have already made some sort of plan for
> how
> to notify the user of syntax errors. Or maybe it is not desirable for some
> reason?
>

I don't think we really thought about it. For IPython, our extra syntax is
limited enough that if something's invalid, we just want a standard Python
SyntaxError.

I'm don't object to adding the ability to raise exceptions, if it can be
done neatly without impacting our use cases. But I also partly feel that if
Sage is extending the syntax that much, it should probably be thinking
about writing a proper parser. Our input transformation machinery is really
intended to support some extensions to Python syntax, not the definition of
a whole Python-like programming language.

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130809/f5f4c207/attachment.html>


More information about the IPython-dev mailing list