On Wed, Jul 24, 2013 at 10:02 AM, Robert Bradshaw
<rober...@math.washington.edu> wrote:
> On Wed, Jul 24, 2013 at 6:00 AM, Simon King <simon.k...@uni-jena.de> wrote:
>> Hi!
>>
>> On 2013-07-24, Volker Braun <vbraun.n...@gmail.com> 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+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.
>
>



-- 
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