Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Flush stdin Date: Wed, 22 Oct 2014 13:57:28 +0300 Organization: A noiseless patient Spider Lines: 21 Message-ID: <87y4s8wew7.fsf@elektro.pacujo.net> References: <87a94rgxi5.fsf@elektro.pacujo.net> <87mw8qfhza.fsf@elektro.pacujo.net> <87h9yyf318.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="26031"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+QXPCiru+z2eWMmVmo3MK" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:30gkDSkRzdFGjA2qdUTIAvp7KSA= sha1:nmg6OgWdRGfnyLznQlR5bZNtNgU= Xref: csiph.com comp.lang.python:79429 Dan Stromberg : > On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa wrote: >> Terminal devices support line buffering on write. > Yes, though that's not the only place it's useful. > >> Line buffering on read is an illusion created by higher-level libraries. >> The low-level read function reads in blocks of bytes. > > Actually, doesn't line buffering sometimes exist inside an OS kernel? > stty/termios/termio/sgtty relate here, for *ix examples. Supporting > code: http://stromberg.dnsalias.org/~strombrg/ttype/ It turns on > character-at-a-time I/O in the tty driver via a variety of methods for > portability. I wrote it in C before I took an interest in Python. I was being sloppy in my TTY terminology. A TTY device is running inside the kernel and thus "writes" by copying bytes from its kernel buffer into the user space when the user space process calls read(2). Marko