I should not that all single-case letters used to be defined, and I for one was often bitten by this in strange ways.
On Fri, May 11, 2012 at 11:13 AM, Nils Bruin <nbr...@sfu.ca> wrote: > On May 11, 12:37 am, Julien Puydt <julien.pu...@laposte.net> wrote: > >> NameError: name 'y' is not defined -- perhaps you need to type var('y') >> first ? > > A nice idea, but I don't think NameError is sufficiently aware of the > context it is raised in to make reliable suggestions: > > sage: sinus(pi/3) > NameError: name 'sinus' is not defined -- perhaps you need to type > var('sinus') first? > sage: var('sinus') > sage: sinus(pi/3) > [Deprecation warning] > 1/3*pi > sage: sinus(pi/3) > 1/3*pi > > Following the advice indeed makes the error go away, but likely > doesn't produce the result the user intended. When the declaration warning becomes an error, it will be a bit better. Certainly an argument for not making all undefined symbols into symbolic variables. One can write SR("a*x+b") and it defines the variables for you (though not globally IIRC). > Also, I'm afraid NameError gets raised somewhere in the innards of > Python, so to implement this idea we probably would need to patch > Python. I bet we could catch this and re-throw a modified version; we have hooks into the read-eval-print loop to do preparsing, for example. - Robert -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org