Chris Angelico <ros...@gmail.com>:

> There's a huge difference between a loop that calls a blocking
> function like (raw_)input and one that calls a non-blocking function
> like kbhit(). One of them is polite to other processes; the other is
> not.

Each process can have its own PTY with a separate virtual keyboard
interface. The main problem is that the Unix terminal interface is quite
old and crude.

I'm guessing the raw inputs come from the /dev/input/* drivers.
Unfortunately the PTYs don't come with their faked /dev/input drivers,
and they would be reserved for root anyway.

> In fact, even in a single-user single-process system, polling is a bad
> idea - it means that nothing can go to sleep.

Yes, spinning is bad. However, there are nicer ways to poll: select,
poll, epoll...

> Unless, of course, you want to reimplement the whole concept of
> blocking calls on top of non-blocking ones, in which case... why?!?

Blocking calls are evil.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to