Hacker News new | ask | show | jobs
by underdeserver 616 days ago
For those interested in the REPL improvements:

" Python now uses a new interactive shell by default, based on code from the PyPy project. When the user starts the REPL from an interactive terminal, the following new features are now supported:

Multiline editing with history preservation.

Direct support for REPL-specific commands like help, exit, and quit, without the need to call them as functions.

Prompts and tracebacks with color enabled by default.

Interactive help browsing using F1 with a separate command history.

History browsing using F2 that skips output as well as the >>> and … prompts.

“Paste mode” with F3 that makes pasting larger blocks of code easier (press F3 again to return to the regular prompt). "

Sounds cool. Definitely need the history feature, for the few times I can't run IPython.

4 comments

Thanks, I just found out about .pythonstartup and setup writing history to a file and pretty printing with pprint / rich.

https://www.bitecode.dev/p/happiness-is-a-good-pythonstartup or search for a gist

No vi editing mode :-(

> The new REPL will not be implementing inputrc support, and consequently there won't be a vi editing mode.

https://github.com/python/cpython/issues/118840#issuecomment...

iPython is a much better repl anyway, use that, it has a vi mode
Presumably this also means readline (GPL) is no longer required to have any line editing beyond what a canonical-mode terminal does by itself. It seems like there is code to support libedit (BSD), but I've never managed to make Python's build system detect it.
I have managed to build Python with libedit instead of readline, but it was a custom build.

If your assumption is correct, then I'm anxiously waiting for having the default Python executable in Ubuntu, for example, being licensed under a non-copyleft license. Then one would be able to build proprietary-licensed executables via PyInstaller much more easily.

I hope it doesn’t break ptpython, and/or is worse than it. I’ve been using it for quite a while.
I don’t think they added autocomplete support so PtPython is still better.