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

Chris Angelico rosuav at gmail.com
Tue Oct 25 14:22:51 EDT 2016


On Wed, Oct 26, 2016 at 3:05 AM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> 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.

http://www.gotterdammerung.org/humor/boh13.html

(Sadly, the official bofh.ntk.net is down, or I'd link to it there.)

ChrisA



More information about the Python-list mailing list