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

Steve D'Aprano steve+python at pearwood.info
Tue Oct 25 12:05:54 EDT 2016


On Tue, 25 Oct 2016 11:49 pm, Chris Angelico wrote:

> In Python, Ctrl-C raises KeyboardInterrupt. If you want to save your
> data, use standard exception handling. (And asking to confirm? Isn't
> that exactly what "Press Enter to continue or Ctrl-C to abort" *is*?)


$  Fire missiles? Press Enter to continue or Ctrl-C to abort.  ^C
$  Are you sure you want to abort? 
   Press Enter to abort or Ctrl-C to abort the abort.  ENTER
$  Did you mean to abort? Press Enter to continue aborting, 
   or Ctrl-C to abort aborting the abort and continue.  ENTER
$  Confirm abort: Enter to abort, Ctrl-C to abort.  ENTER
$  Abort aborted. Missiles fired.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list