Why doesn't Python include non-blocking keyboard input function?

Christian Gollwitzer auriocus at gmx.de
Fri Oct 28 05:22:10 EDT 2016


Am 28.10.16 um 10:59 schrieb Marko Rauhamaa:
> Christian Gollwitzer <auriocus at gmx.de>:
>
>> Am 28.10.16 um 09:33 schrieb Marko Rauhamaa:
>> I am just not convinced that so many people need to implement
>> something like readline.
>
> I don't know. How would you implement "less" in Python? How would you
> implement "nethack" in Python?

On my system:

Apfelkiste:~ chris$ otool -L /usr/bin/less
/usr/bin/less:
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current 
version 5.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1225.0.0)

So "less" in C uses ncurses. You can do the same in Python, "import 
curses" - instead of fiddling with terminal escape characters you leave 
that to a library, just like less does it.

> Well, Python does offer it all. You do it like you would in C. You set
> the terminal mode.
>
> When in Linux, do as the Linux system programmers do. I'm glad Python
> hasn't tried to hide Linux under shoddy abstractions -- or at least I'm
> not forced to use them.

Agreed.

	Christian




More information about the Python-list mailing list