Rats... I meant to say in the discussion below that if your docstring is like ''' That's all folks ...
you see the "bypass Sage" behavior, while the same string with """ gives you expected behavior. So perhaps two problems: - parser gets confused with too many single quotes (Sage parser problem) - can't assign to a function (language definition problem) Does Sage permit "f(x) = x^3"? Python doesn't, I think. Justin On Oct 30, 2008, at 07:49 , Justin C. Walker wrote: > > > On Oct 30, 2008, at 06:22 , kcrisman wrote: >>> Yes. Could you please post the said link. I really want to know what >>> caused the problem you're describing. >> >> http://math.uchicago.edu/~crisman/Weird_Notebook_Behavior.sws >> >> I would try it out sagenb.org, but... :) However, I did try it on >> our >> departmental server (which is 3.0.4, I think) and it also blew up. >> >> Sample function which causes problems: >> >> sage: def plot_or_not(): >> ....: ''' >> ....: What's up with this? x^3 >> ....: ''' >> ....: f(x)=x^3 >> ------------------------------------------------------------ >> File "<ipython console>", line 5 >> SyntaxError: can't assign to function call (<ipython console>, line >> 5) > > Coming in late, but if this is literally what your example is, I think > the problem is the "f(x)=x^3". Can you do that? > > If I try this > > def foo(x): > f(x) = x^3 > return f(x) > > on 3.2.alpha0, without any doctstring, it blows up with > > TypeError: Must construct a function with a tuple (or list) of > SymbolicVariables. > > when I try to run it. If I add a docstring with """, it blows up the > same way. If I add a docstring with ''', it blows up with the syntax > error. Likewise, if I try this with "sage -python", I get the syntax > error. > > Also, I tried this: > def foo(x): > x = x^2 > return x > > If I put in a docstring with """, foo(3) returns 9; with ''', foo(3) > returns 1 ! > > It seems that the ''' docstring causes the definition to bypass Sage, > while with the """ docstring, the definition is handled by Sage. > > Is that possible? > > Justin > > -- > Justin C. Walker, Curmudgeon at Large > Institute for the Absorption of Federal Funds > ----------- > Like the ski resort full of girls hunting for husbands > and husbands hunting for girls, the situation is not > as symmetrical as it might seem. > - Alan MacKay > -- > > > > -- Justin C. Walker, Curmudgeon at Large Institute for the Absorption of Federal Funds ----------- If it weren't for carbon-14, I wouldn't date at all. ----------- --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---