New submission from Marco Sulla <launchpad....@marco.sulla.e4ward.com>:

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.

----------
components: Demos and Tools
messages: 356248
nosy: Marco Sulla
priority: normal
severity: normal
status: open
title: Slowly introduce a subset of Jupyter console (IPython) features into 
CPython command line interactive mode
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38747>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to