If you simply copy-paste into the sage commandline, you will get that error
since after the `return(1)` line, indention goes back one level, like so:

sage: def ff(n):
....:            if n == 0:
....:                return(1)
....:        else:
---------------------------------------
[Errors]

Since sage.el interfaces with the sage commandline, I will have to assume
the same thing happened. It's a problem with IPython, so I don't think
there's much to be done about it.

Last time I tried `sage.el`, there was a command to send input directly to
the comandline buffer, something like send/evaluate region. Perhaps you can
try that?

On Wed, Sep 23, 2009 at 10:29 PM, Francois Maltey <fmal...@nerim.fr> wrote:

>
> Hello Everybody !
>
> With sage in emacs I test this single function, but I get an error :
>
> > def ff (n) :
> >   if n==0 :
> >       return(1)
> >   else :
> >       return(n*ff(n-1))
> I type theses lines in a buffer, and I copy by Ctrl-K / Ctrl-Y in
> sage-buffer
> Then I get this error :
>
> > ....: ....: ....:
> > ------------------------------------------------------------
> >    File "<ipython console>", line 4
> >      se :
> >       ^
> > SyntaxError: invalid syntax
> >
> > sage: ------------------------------------------------------------
> >    File "<ipython console>", line 1
> > SyntaxError: 'return' outside function (<ipython console>, line 1)
> >
> > sage:
> But functions and tests without "else :" are right.
> I deplace the else: line at the very beginning, under others lines and
> get the same error.
>
> What is the shortest test with else: I must try ?
>
> Many thanks.
>
> F.
>
>
> >
>


-- 
Tim Joseph Dumol <tim (at) timdumol (dot) com>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to