Baffled by readline module

Grant Edwards grant.b.edwards at gmail.com
Fri Mar 10 09:37:56 EST 2023


On 2023-03-10, Weatherby,Gerard <gweatherby at uchc.edu> wrote:

> I would say, “No, readline is not the right tool.”
>
> cmd.Cmd is: https://docs.python.org/3/library/cmd.html. I have a
> couple of cmd.Cmd modules, one of which I use daily and the other
> weekly.

I'll have to remember that one. It doesn't really fit my current use
case, but there are others where it would work nicely.

However, cmd.Cmd does not provide command recall and
editing. According to the page above, that's provided by the readline
module:

     If the readline module is loaded, input will automatically
     inherit bash-like history-list editing (e.g. Control-P scrolls
     back to the last command, Control-N forward to the next one,
     Control-F moves the cursor to the right non-destructively,
     Control-B moves the cursor to the left non-destructively, etc.).

--
Grant


More information about the Python-list mailing list