Author Marco Sulla
Recipients Marco Sulla
Date 2019-11-08.16:38:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573231108.59.0.407559138222.issue38747@roundup.psfhosted.org>
In-reply-to
Content
Sometimes I’m lazy and I would test code copy - pasted from internet or from other sources directly in the interpreter, in interactive mode. But if the code contains completely blank lines, the copy - paste fails. For example:

def f():
    print("Marco")

    print("Sulla")

does not work, but

def f():
    print("Marco")
    
    print("Sulla")

yes. Notice that in a script the first code block is perfectly valid and works.

This does not happen with Jupiter console, aka IPython. Jupiter implements bracketed paste mode, so it distinguish between normal input and pasted input.

Jupyter offers also:
- autoindent
- save code blocks in one history entry: this way, if you write a function, for example, and you press the up key, the whole function will be loaded, and not its last line.
- auto-reloading of modules. It should be disabled by default and enabled by a flag, and could auto-reload a module if its code changes.
- save code to console. All the code written in the current interactive session could be saved to the clipboard. It could be triggered by F12.
- history: it could be a new built-in function. if called without parameters, it could show the history, with lines numbered. If called with a number, it will paste the corresponding history line to the console
- pretty printing and source inspection. IMHO pprint.pprint() and inspect.getsource() are so useful in interactive mode that could be added to builtins.
- syntax coloring. It should be disabled by default, and could be enabled by a flag or a config.
- bracket matching. See above.

I think that implementing all of this in CPython is really hard. I suppose that maybe many things are not possible for compatibility between platforms, or can't be available everywhere, like syntax coloring.
History
Date User Action Args
2019-11-08 16:38:28Marco Sullasetrecipients: + Marco Sulla
2019-11-08 16:38:28Marco Sullasetmessageid: <1573231108.59.0.407559138222.issue38747@roundup.psfhosted.org>
2019-11-08 16:38:28Marco Sullalinkissue38747 messages
2019-11-08 16:38:27Marco Sullacreate