On 28/10/2016 11:35, Marko Rauhamaa wrote:
BartC <b...@freeuk.com>:

On 28/10/2016 10:22, Christian Gollwitzer wrote:
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.

As I commented further up the thread, I tried 'import curses' in
Windows and it said it couldn't find the module.

I can't comment on Windows. I'm only talking about Linux. Christian was
talking about OSX.

As for why there isn't a facility that would do it on all platforms,
that question is akin to: Oh, why can't everybody just speak English?

If you intend this keyboard handling to be a very minor part of a
larger application, you don't want it falling over the first time
someone tries to use it.

Didn't someone in this thread already mention a way to do it in Windows?

There are a million ways to do it. But you don't want a million, you want one.

Otherwise "A" will now need to create a new library which presents a common API to the application but internally takes care of the differences between platforms. But now you have an extra dependency for your app. Your own code is not a problem; you just bundle it with the app. But platform-dependent dependencies (if that makes sense) can be a problem.

And "B" who wants to use the same functionality will have to find their own solution, and so on.

This is exactly the sort of 're-inventing the wheel' that not including the functionality in the language was supposed to avoid!

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

Reply via email to