[Python-ideas] Remove tty module

Clay Sweetser clay.sweetser at gmail.com
Thu Jul 25 10:08:44 CEST 2013


On Jul 24, 2013 7:08 AM, "Andrew Barnert" <abarnert at yahoo.com> wrote:
>
> On Jul 24, 2013, at 11:01, "M.-A. Lemburg" <mal at egenix.com> wrote:
>
> > On 24.07.2013 10:43, anatoly techtonik wrote:
> >> http://hg.python.org/cpython/file/74fd1959cf44/Lib/tty.py
> >>
> >> tty module is cryptic. The low level interface it is exposed can be
> >> covered by appropriate recipes in termios module documentation. You
> >> can't understand tty without understanding termios. You also can't
> >> understand tty without being a Unix guru -
> >> http://en.wikipedia.org/wiki/TTY I doubt that raw mode function (which
> >> is 50% of this stuff) is really used by anyone.
>
> Many novices want a way to read a character from the tty without waiting,
to create simple keyboard menus or just "press any key to continue" apps
without using curses or a GUI app.
>
> It would be even nicer if there were an easier way to do this (especially
one that worked on both unix and windows); it's a pretty common question on
StackOverflow and people are always disappointed at how complicated the
answer is. But making it even harder is probably not a good idea.
Yeah, I'm with you on the windows compatibility; It's always annoyed me
that tty and termios (along with most of curses) is Unix only, when I'm
fairly sure that windows has enough functionality in it's api that
replication is possible. Still, I'm no expert on Window's api, so I may be
wrong.
>
> So, maybe if we had a higher level "consoleio" module along with the low
level termios we wouldn't need the mid level tty.
>
> >> In ideal world the tty should be substituted with interface with less
> >> cryptic terminology replacing cbreak mode, cooked mode, raw mode with
> >> user oriented concepts. Otherwise this functionality is already
> >> covered by termios interface.
>
> I'm not sure providing the existing mid level functionality with
friendlier but less standard (and therefore harder to look up) names would
really help much.
>
> > Better references:
> > http://en.wikipedia.org/wiki/POSIX_terminal_interface
> > http://en.wikipedia.org/wiki/Cooked_mode
> >
> > cbreak and raw modes are needed for e.g. games or editors that
> > need low-level access to the keyboard.
> >
> > For a user oriented TTY interface, have a look at
> > http://en.wikipedia.org/wiki/Ncurses and
> > http://docs.python.org/2.7/library/curses.html
>
> Curses is great, but sometimes you want raw io without it. For one thing,
occasionally you need to deal with a platform that doesn't have curses
(like iOS). But more generally, sometimes all you want is raw input,
without console windowing and other fancy stuff--again, think of those
novices with their "press any key to continue" apps. So, a very simple pure
python library on top of unix termios and windows conio might be nice as
well.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130725/6636dc97/attachment-0001.html>


More information about the Python-ideas mailing list