On Sun, Nov 2, 2008 at 10:35 AM, Simon King <[EMAIL PROTECTED]> wrote: > > Hi! > > On Nov 2, 6:18 pm, "William Stein" <[EMAIL PROTECTED]> wrote: >> >> People coming from a Mathematica background should not assume that >> >> they know all there is to know about how to use a Computer Algebra >> >> System, and instead, read the documentation. >> >> > This is so obnoxiously wrong, I just don't know where to start. >> >> What is wrong? That statement Justin made or that he made it at all? > > I think Justin's statement is true in the sense that people with a > Mathematica, Maple, Magma or Sage background should not believe that > the respective system is the philosopher's stone. It should be self- > evident that changing from one system to another sometimes involves to > look into a manual. > > On the other hand, the statement is partially wrong in the following > sense: We should not *suppose* that a person changing from Mathematica > to Sage will first thoroughly read the manual. I agree with Robert, > who wrote that one should try to accomodate the people. > > I think Harald is right that a descriptive error message can be very > helpful to a novice. The problem is that a very descriptive message > would depend on the context, and making it context-sensitive would > involve work. But it is (to some extent) doable! > > Example: > ------------- > 1. > sage: y > ... > NameError: name 'y' is not defined > > That's clear enough. > > 2. > sage: sin(y) > ... > NameError: name 'y' is not defined > > That's the same message - but the context (calculus-function) makes it > clear that the user wanted to make y a variable. Suggestion: > > 3. > Context sensitivity could be obtained by catching and re-raising > errors. > Would it be possible that the calculus-functions catch any NameError > and re-raise it with an extended error message? The following error > message may be a better help to the people: > sage: sin(y) > ... > NameError: name 'y' is not defined. If 'y' is intended to be a > variable, please use var('y'). Type var? for help
The NameError is raised before the code is ever evaluated by the sin function. It is a raised when the code is being parsed by Python in the first place. So I don't know how it would be possible to do what you suggest above. William -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---