Baffled by readline module

Grant Edwards grant.b.edwards at gmail.com
Fri Mar 10 17:38:28 EST 2023


On 2023-03-10, Cameron Simpson <cs at cskk.id.au> wrote:
> On 10Mar2023 09:12, Grant Edwards <grant.b.edwards at gmail.com> wrote:
>>On 2023-03-10, Weatherby,Gerard <gweatherby at uchc.edu> wrote:
>>> On our Linux systems, I can up-arrow to go back to prior commands
>>> and use the left and right arrows to navigate a line. The
>>> functionality may be provided internally by readline. I’ve never had
>>> to dig into it because it meets my needs out of the box.
>>
>>Apparently the cmd.Cmd docs are wrong. It says:
>>
>>      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.).
>>
>>On my Python 3.10.10 Linux system, cmd.Com itself is importing the
>>readline module unconditionally when I call cmdloop(). There's no 'if'
>>about it.
>
> I was wondering about that myself, whether this is an accident of 
> phrasing. It doesn't say "is imported", so maybe the author was thinking 
> "if readline's part of the install" here.

Ah, that never ocurred to me. I understood "loaded" to mean "imported"
without giving it a second thought.  It probably does mean supported.





More information about the Python-list mailing list