Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python.': 0.02; '21,': 0.07; 'discard': 0.07; 'dan': 0.09; 'newline': 0.09; 'received:internal': 0.09; "they've": 0.09; 'wrote': 0.14; 'line).': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'tty': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'driver': 0.24; 'code:': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'rest': 0.29; "doesn't": 0.30; 'says': 0.33; 'cases': 0.33; 'received:66': 0.35; 'really': 0.36; 'data,': 0.36; 'next': 0.36; 'url:org': 0.36; 'received:10': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'supporting': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'from:no real name:2**0': 0.61; 'took': 0.61; 'course': 0.61; 'header:Message-Id:1': 0.63; 'kind': 0.63; 'interest': 0.64; 'reads': 0.68; 'behavior': 0.77; '2014,': 0.84; 'actually,': 0.84; 'examples.': 0.84; 'relate': 0.84 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=jAR5K+aHLY3q0a50RN3wbW5G9Zc=; b=AwND T4u542geMnEGr3QSHfJRWK2yMqtNO5f3HLnGW6MPS9J7xylC1GG/1nvfaFBmtao1 gMZ7O5mkEJZ8EDfLHp/Le11VnFIi//05GGDh1ty+nFlkhGEYH14/H/TOI0WwlYYC 08YkGM6No9xSCbO0gTSnLu1iPy1GwFj2EVIYio4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=jAR5K+aHLY3q0a50RN3wbW5G 9Zc=; b=sj0/SbAfVnvgyAI2qG3CmbyztT04dYcj/ECVlvAPGmgaPtSvQCNSXz4M Oqgh8rBZEzt6hxx3aCBjeoDxbYi8v9ONbaIkbwaFglFolXAloRjqR/hSfXf9waJB Fkv6WWK1InP8hldqAVIFoVYSMrCVcT1xBMd1IfN73XUUGHszZSU= X-Sasl-Enc: DSL8RHrNleDWzmKHomJna+TqPtYn+XrFg5tMFcTWsig5 1413990065 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-87015d4b In-Reply-To: References: <87a94rgxi5.fsf@elektro.pacujo.net> <87mw8qfhza.fsf@elektro.pacujo.net> <87h9yyf318.fsf@elektro.pacujo.net> Subject: Re: Flush stdin Date: Wed, 22 Oct 2014 11:01:05 -0400 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413990068 news.xs4all.nl 2927 [2001:888:2000:d::a6]:47319 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:79444 On Tue, Oct 21, 2014, at 19:16, Dan Stromberg wrote: > 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. Yes, and 90% of the time, when someone says they want to "flush stdin", what they really want to do is go to the next line after they've sloppily read part of the line they're on (and the behavior they are seeing that they object to is that their next read function reads the rest of the current line). The appropriate course of action in these cases is to actually read to the next newline and discard the data, not to do any kind of flush.