Why doesn't Python include non-blocking keyboard input function?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Oct 27 02:51:57 EDT 2016
On Thursday 27 October 2016 12:12, BartC wrote:
> I don't
> understand the argument that a language shouldn't have a basic keyboard
> API because some computers it could run on might not have a keyboards.
That's not the argument. The argument is that Python has a basic keyboard API:
raw_input (in Python 2) or input (in 3).
This supports 97% of keyboard-based interaction, namely blocking line-based
text input. Ctrl-C (KeyboardInterrupt) can be co-opted to support maybe another
one or two percent.
The question is, what are the use-cases for the sorts of key APIs you are
asking for? Who needs them? Why should it be a language feature?
Those are not rhetoricial questions.
Python falls neatly into the same niche of languages as (for example) Ruby,
Javascript, Lua, Swift, Tcl, and (not quite as well) bash, Java, Julia. Which
of these languages offer non-blocking keyboard input as a standard part of the
language?
Python has no "peek" and "poke" memory access commands either. It's not 1972
and programming has moved on. The utility of something like this feature is
very low, the amount of effort needed for a cross-platform solution is very
high.
--
Steven
git gets easier once you get the basic idea that branches are homeomorphic
endofunctors mapping submanifolds of a Hilbert space.
More information about the Python-list
mailing list