How to get numbered prompt
A lot of Ipython docs show numbered prompts like 'In [4]:'. With Sagemath 9 I only have the prompt 'sage:'. How can you set the prompt?
A lot of Ipython docs show numbered prompts like 'In [4]:'. With Sagemath 9 I only have the prompt 'sage:'. How can you set the prompt?
You can do this :
sage: from IPython.terminal.prompts import Prompts
sage: ip = get_ipython()
sage: ip.prompts = Prompts(ip)
In [4]: 1+1
Out[4]: 2
In [5]: 2+2
Out[5]: 4
In [6]: Out[5]^2
Out[6]: 16
If you want this to be executed each time Sage is started,
put these three lines in your init.sage
file, which by default
is the file ~/.sage/init.sage
(create it if it does not exist yet).
And about customizing the prompt, see my answer to this other post.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2020-04-27 16:30:56 +0100
Seen: 579 times
Last updated: Apr 27 '20
Why bother ?
Because the manual refers to it., and it allows one to easily reuse previous results from back before the underscore references allow. It's a perfectly legitimate question I would have thought.