Maybe it's just me, but I find it terribly annoying that one cannot
paste code fragments containing indentation in a Sage terminal
session, as one can with the ordinary Python interpreter. Simple
example:
def f(x):
if x == 1:
return 2
return 1
>>> def f(x):
... if x == 1:
... return 2
... return 1
...
sage: def f(x):
....: if x == 1:
....: return 2
....: return 1
------------------------------------------------------------
File "<ipython console>", line 4
rn Integer(1)
^
SyntaxError: invalid syntax
Is this an IPython bug (and in that case can it be fixed or worked
around), or is it a preparser issue?
Fredrik
I agree it is annoying, but not sure whether it can be considered a "bug".
John
On Tue, Apr 19, 2011 at 3:47 PM, John H Palmieri <jhpalm...@gmail.com> wrote:
>
> This is not a direct answer, but I would suggest setting the environment
> variable EDITOR to be something you like (like "/usr/bin/emacs") and then do
> this:
>
> sage: ed
>
> This will pop open an editor. Then you can type in the function definition
> using all of the features of your editor:
>
> def my_great_function(x):
> if x==1:
>
> (etc.) Once you do this, from the "sage:" prompt, you can type "ed
> my_great_function" to modify the definition.
>
> --
> John
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>
John, that is an absolutely brilliant feature I had no idea existed.
It should be better known -- thanks!
John