Praveen Praveen - 4 months ago 15
Python Question

IPython 5.0: Remove spaces between input lines

(This question is essentially this question, but for IPython version 5.0)

I'd like to have a classic prompt with IPython 5.0.

This question helps customize my prompt. In fact, I discovered that IPython has a class definition for the

ClassicPrompts
already.

All I need to do is to put the following in a file called
00-classic-prompts.py
or some such in
~/.ipython/profile_default/startup/
:

from IPython.terminal.prompts import ClassicPrompts

ip = get_ipython()
ip.prompts = ClassicPrompts(ip)


But different prompt lines still render as:

>>> print('Hello world!')
Hello world!

>>>


With an extra new-line before every input prompt. How can I remove this?

I notice the existence of a class called
IPython.core.interactiveshell.SpaceInInput
in the IPython docs, but how do I use it?
(Looks like this class is an exception, meant for something else)

wim wim
Answer

Please append this line on the bottom of your existing startup script:

ip.separate_in = ''