Author mbussonn
Recipients Jim Fasarakis-Hilliard, brett.cannon, emilyemorehouse, mbussonn, serhiy.storchaka, terry.reedy, xoviat
Date 2017-02-14.06:11:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> IPython3 solved this issue by adding special magic functions, but this is not a way for CPython.

IPython 5 improve on that with prompt toolkit. It does not break paste, as prompt_toolkit has a bracketed-past mode, that most terminal emulator support  (control chars sent by terminal "hey I'm pasting", "hey I'm done pasting"). So it works nicely. IPython 6 even will remove the need for magics to activate paste mode.

Though it's far from trivial to implement and to get it "right".

Once you start giving indentation to user, they start to be demanding, like indenting 1 more on `:`, and one less on `return`, `pass`... , multiple line string. etc...

See for some of the issues and limitation you can hit.

If you decide to implement this kind of things, there are likely a lot you can borrow from IPython, the InputSplitter class has likely the sate needed to give you the indent level to use in readline.
Date User Action Args
2017-02-14 06:11:26mbussonnsetrecipients: + mbussonn, brett.cannon, terry.reedy, serhiy.storchaka, emilyemorehouse, Jim Fasarakis-Hilliard, xoviat
2017-02-14 06:11:26mbussonnsetmessageid: <>
2017-02-14 06:11:26mbussonnlinkissue29339 messages
2017-02-14 06:11:25mbussonncreate