[Python-ideas] Remove tty module

M.-A. Lemburg mal at egenix.com
Thu Jul 25 09:53:32 CEST 2013


On 25.07.2013 00:56, Cameron Simpson wrote:
> On 24Jul2013 11:01, M.-A. Lemburg <mal at egenix.com> wrote:
> | cbreak and raw modes are needed for e.g. games or editors that
> | need low-level access to the keyboard.
> 
> Raw mode is also needs to talk to arbitrary serial devices. I've
> written code for such, and having some line discipline in the way
> would be disasterous. Not everything is a keyboard:-) (Disclaimer:
> that app was in Java, but the situation in Python would be unchanged.)
> 
> I see "tty" only supplies two functions and explicitly requires
> termios anyway; why weren't these functions just provided as
> convenience routines inside termios?
> (I can imagine someone forward thinking saying "this could work elsewhere".)
> 
> That said, termios could be ported to other platforms fairly easily,
> at least for most of it.
> 
> I certainly wrote myself a termios layer in C for V7 UNIX, which
> didn't have it but did have the older tty setup intrerfaces. Any
> other OS presenting a serial line control library could probably
> be targeted nearly as easily for the basics (raw mode, tty speed,
> parity et al).

Looking at the code, it seems that the tty module was meant
as higher level Python module for terminal interaction,
whereas termios implemented the C parts - much like we
have with ssl.py and the _ssl C module.

tty does an import * of all termios symbols.

Hard to say whether that was the original motivation, though,
since the two modules are really old (both were added in 1994).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 25 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-ideas mailing list