[Python-ideas] Option of running shell/console commands inside the REPL

eryk sun eryksun at gmail.com
Fri Feb 1 21:43:53 EST 2019


On 2/1/19, Terry Reedy <tjreedy at udel.edu> wrote:
> On 2/1/2019 3:31 PM, Oleg Broytman wrote:
>
>> Python REPL is missing the following batteries:
>> * Persistent history;

Python's built-in REPL relies on the readline module for history. In
Windows you'll need to install pyreadline, an implementation that uses
the Windows console API via ctypes.

Out of the box, Python uses the the built-in line editing and history
that's provided by the Windows console host (conhost.exe). There's an
undocumented function to read this history (as used by doskey.exe),
but there's no function to load lines into it. I suppose it could be
replayed manually in a loop that calls WriteConsoleInputW and
ReadConsoleW.

> * Windows Console holds a maximum of 9999 characters,

9999 lines, not characters.


More information about the Python-ideas mailing list