On Jan 17, 2012 10:25 AM, "Jason Grout" <jason-s...@creativetrax.com> wrote: > > On 1/17/12 12:18 PM, Jason Grout wrote: >> >> On 1/17/12 12:11 PM, William Stein wrote: >>> >>> >>> On Jan 17, 2012 10:06 AM, "Jason Grout" <jason-s...@creativetrax.com >>> <mailto:jason-s...@creativetrax.com>> wrote: >>> > >>> > On 1/17/12 12:01 PM, William Stein wrote: >>> > >>> >> Nils example is interesting though, since it suggests using SR.var >>> >> instead of var in preparsing callable symbolic function creation. >>> >> E.g., instead of >>> >> >>> >> sage: preparse('f(x) = 10*x') >>> >> '__tmp__=var("x"); f = symbolic_expression(Integer(10)*x).function(x)' >>> >> >>> >> do >>> >> >>> >> sage: preparse('f(x) = 10*x') >>> >> '__tmp__=SR.var("x"); f = >>> symbolic_expression(Integer(10)*x).function(x)' >>> > >>> > >>> > Wouldn't that need to be: >>> > >>> > 'x=SR.var("x"); f = symbolic_expression(Integer(10)*x).function(x)' >>> > >>> > since x is not injected into the namespace then? >>> > >>> >>> I think it should be __tmp__ on the right instead of x. >>> >> >> If you used x, then you'd automatically have injection in the *local* >> namespace. > > > which I might add preserves the existing behavior at the top level, but gets rid of the global-scope bug if the notation is used inside of a function. > >
Interesting - so use the preparser to 'modify local' instead of some scary thing in cython? Interesting... Maybe the global var could be changed to do something like that, instead of mucking with globals(). > Jason > > > > -- > 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 -- 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