How can I handle the char immediately after its input, without waiting an endline?

Lie Ryan lie.1296 at gmail.com
Sat Oct 25 18:07:30 EDT 2008


On Sat, 25 Oct 2008 15:27:32 +0000, Steven D'Aprano wrote:

> On Sat, 25 Oct 2008 16:30:55 +0200, Roel Schroeven wrote:
> 
>> Steven D'Aprano schreef:
>>> I can't think of any modern apps that use one character commands like
>>> that. One character plus a modifier (ctrl or alt generally) perhaps,
>>> but even there, it's mostly used in GUI applications.
>> 
>> less, vi, info, top, cfdisk, lynx, links, ... come to mind. I suppose
>> there are many more that I can't think of at the moment.
> 
> I said modern *wink*
> 
> But seriously... point taken.
> 

I uses some of them a lot... less and top is on the top of my list (pun 
intended). I sometimes used vi(m), although I never really liked it, but 
it's sometimes unavoidable. info is replaced by man. lynx and links... 
well I remember a time when I tried to install Gentoo on a VMWare, lynx/
links (I forgot which one) was a life-saver because I wouldn't need to 
get out to the Windows host every two seconds to see the installation 
instruction (I was new to Linux at that time), and that was on a VMWare, 
what if I installed it directly, not on a virtual machine?

And as far as I know, it is impossible to implement a "press any key" 
feature with python in a simple way (as it should be). And if std input's 
character buffering is easy, it'd contribute a lot to command-line real 
time action games (and of course many other programs, but that is the 
first genre of programs that crosses my mind).

PS: 
>>> modern != GUI
True
>>> commandline == old
False




More information about the Python-list mailing list