Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage in console: newline characters?

I like to use sage in a linux console, rather than the notebook interface, simply for speed and convenience. However, I have problems if I want to edit a multi-line statement. For example, suppose I enter:

for i in range(10):
    if is_prime(i):
        print i

If I want to edit this, or maybe just run it again, when I call it up with the history mechanism, what I see is

for i in range(10):^J    if is prime(i):^J        print i

This can be very inconvenient if there are lots of short lines. (I can get round this by running sage within GNU screen.) I'm not quite sure how I encourage newlines to be interpreted as, well new lines rather than newline characters, and whether this is a sage, ipython, or console issue.