Its of course a quite difficult machine learning exercise to find the 
optimal match from tracebacks to hints that are helpful to a beginner. 
Though deciding based on a regex on the input and traceback is probably a 
good start. 



On Thursday, April 2, 2015 at 4:16:39 PM UTC+2, William wrote:
>
> On Thu, Apr 2, 2015 at 7:02 AM, kcrisman <[email protected] <javascript:>> 
> wrote: 
> >> 
> >> We could translate en dash into hypen on the commandline to avoid that 
> >> surprise... 
> > 
> > 
> > Interesting idea, though what if it was intended in something, such as a 
> > plot legend? 
> > 
>
> Another idea would be to do something only if an exception is actually 
> raised.   I.e., if a user interactively runs some block of input (in a 
> notebook, command line, whatever), and it raises an exception, we 
> could have a library of tests we run on that input which could then be 
> used to provide further help to the user.  For example, if the input 
> string is 
>
>    "x sin(x)" 
>
> which by default results in 
>
> Traceback (most recent call last): 
> ... 
> SyntaxError: invalid syntax 
>
> then the UI could call a function such as 
>
>   sage.misc.error_hints("x sin(x)", stack trace info, globals()) 
>
> that in this case might return something like 
>
> "In Python multiplication is denoted using an asterisk.  For example 
> to multiply 2 times 3 write '2*3'." 
>
> The hint could then be displayed before or after or next to the traceback. 
>
> We would slowly build up a body of hint heuristics based on questions 
> we get from users.    The very first one might involve an em-dash. 
>
> Another example is the following.  Suppose the user types 
>
>   var('x') 
>
> and gets the error "TypeError: 'str' object is not callable".  Then 
> our hint would point out that they have set var equal to a string and 
> should set it back to var by typing reset('var').   I have to answer 
> exactly this question somewhat regularly. 
>
> Another: suppose the user types 
>
>    x + y 
>
> and gets "NameError: name 'y' is not defined"... then we tell them about 
> var. 
>
> A large amount of common help/support questions could have the answers 
> automated and built in.   This would be 100% optional, triggered only 
> on interactive errors, and not change Sage's library in any way 
> (except possibly with the addition of this). 
>
>  -- William 
>
>
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to