The problem is that exceptions raised by the inputsplitter are not handled 
by IPython. I've asked at IPython-devel 
at http://python.6.x6.nabble.com/InputSplitter-and-SyntaxError-td5025938.html 
but didn't get an answer so far.


On Thursday, July 25, 2013 10:46:00 AM UTC-4, William wrote:
>
> On Wed, Jul 24, 2013 at 10:02 AM, Robert Bradshaw 
> <robe...@math.washington.edu <javascript:>> wrote: 
> > On Wed, Jul 24, 2013 at 6:00 AM, Simon King 
> > <simon...@uni-jena.de<javascript:>> 
> wrote: 
> >> Hi! 
> >> 
> >> On 2013-07-24, Volker Braun <vbrau...@gmail.com <javascript:>> wrote: 
> >>> Upstream does not allow the input transformer to fail, so either its a 
> >>> not-yet-implemented feature in IPython or we are abusing the IPython 
> >>> mechanism to parse the input where only trivial transformations should 
> be 
> >>> done. Can you post this to the ipython mailinglist? 
> >> 
> >> What's the problem? Nobody forces us to let the preparser raise an 
> >> error. So, instead of raising an error, the preparser should simply 
> >> return the malformed input string, and then it is ipython's job to 
> raise 
> >> the error. 
> > 
> > But if one has something like "R.<x> = QQ[)" then the syntax error at 
> > the first . rather than the correct location. IMHO, IPython should let 
> > the input transformer reject input. 
>
> +1 
>
> Without doing what you suggest there is no way to give a really 
> meaningful error message to the user. 
> This would be especially bad if it were a whole block of code!  For 
> example, 
>
> R.<x> = QQ[] 
> [50 lines of code] 
> S.<t> = QQ{] 
>
> If we just passed it back to IPython unpreparsed, then the error would 
> be in line 1, since that's not valid Python. 
> What we want is to clearly indicate that the error is in the line with 
> the error. 
>
> That said, in this particular case: 
>
>   preparse('R.<t> = QQ{]') 
>
> outputs something that looks like a bug in the preparser implementation: 
>
>     ... 
>     opening = constructor.rindex('[') 
> ValueError: substring not found 
>
> If anything, it should be raising a SyntaxError, right? 
>
> William 
>
> > 
> > - Robert 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com <javascript:>. 
> > To post to this group, send email to 
> > sage-...@googlegroups.com<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/sage-devel. 
> > 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-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to