On Fri, 10 Mar 2023 at 06:28, Grant Edwards <grant.b.edwa...@gmail.com> wrote: > > In an interactive command-line Python program on Linux, I want to be > able to read a line at a time from stdin, providing command line > history and editing to the user. In C, I would use GNU readline to do > that. > > Python has the readline module, which appears to be a wrapper for GNU > readline. However, I've read and re-read the documenation for that > module, but I'm completely baffled. There's all sorts of stuff about > history files, but I neither need nor want a history file. Likewise > tab-completion: don't want it. All the examples not only involve > history files and tab-completion but they're somehow connected to the > interactive Python REPL, which is also completely off-base for my use > case. > > Is the readline module not the right tool for an interactive Linux > command-line application that needs to provide command line recall and > editing to the user who's entering stuff on stdin from a tty? >
Not sure about the history file, and I would assume that if you don't configure one, history is simply lost when you restart. But with tab completion, unless you need to be able to input a tab character, it should be safe to ignore the feature and leave it at the defaults. ChrisA -- https://mail.python.org/mailman/listinfo/python-list