On 2014-02-13, Roy Smith <r...@panix.com> wrote: > I envision SerialPort being a thin layer on top of a bunch of > OS-specific system calls to give them a pythonic interface.
Yep, that's pretty much what pyserial is http://pyserial.sourceforge.net/ > Things like is_shutdown() and set_bit_rate() presumably turn into > ioctls. No need to have any state at all beyond a file descriptor. There are OS-dependent things that it's handy to cache in the object (e.g. a Posix port's current termios settings). It can eliminate a lot of ioctl() calls if the app spends a lot of time doing things like messing with modem control lines. The savings in ioctl() calls may not be worth worrying about, but it's actually simpler/easier to write that way. OTOH, caching the termios settings it can cause breakage if two different processes or port objects are messing with the configuration of a single port. People who do that are just begging for breakage anyway, so they get no sympathy from me... -- Grant Edwards grant.b.edwards Yow! I smell a RANCID at CORN DOG! gmail.com -- https://mail.python.org/mailman/listinfo/python-list