Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79444

Re: Flush stdin

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 <random832@fastmail.us>
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 <CAGGBd_o_c4r0ixP6OndMgOSUj7QhOxU_5w0AFHKya2F4OqDRGw@mail.gmail.com>
References <CAGGBd_r7tdPc1ZTA380-9aNRnbr6Dm3HzhG2cCH2sJwWn=c5iQ@mail.gmail.com> <mailman.14990.1413777392.18130.python-list@python.org> <87a94rgxi5.fsf@elektro.pacujo.net> <CAGGBd_qsZ=-8sn0YQPT1XQf9Qcn9cJ4Aw=hgR6=at0KzjN3xsg@mail.gmail.com> <mailman.15012.1413845578.18130.python-list@python.org> <87mw8qfhza.fsf@elektro.pacujo.net> <mailman.15019.1413851421.18130.python-list@python.org> <87h9yyf318.fsf@elektro.pacujo.net> <CAGGBd_o_c4r0ixP6OndMgOSUj7QhOxU_5w0AFHKya2F4OqDRGw@mail.gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15075.1413990068.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Flush stdin Cameron Simpson <cs@zip.com.au> - 2014-10-20 14:56 +1100
  Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-20 07:45 +0300
    Re: Flush stdin Dan Stromberg <drsalists@gmail.com> - 2014-10-20 14:59 -0700
      Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-21 01:54 +0300
    Re: Flush stdin Dan Stromberg <drsalists@gmail.com> - 2014-10-20 15:52 -0700
      Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-21 02:18 +0300
        Re: Flush stdin Dan Stromberg <drsalists@gmail.com> - 2014-10-20 17:30 -0700
          Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-21 07:41 +0300
            Re: Flush stdin Dan Stromberg <drsalists@gmail.com> - 2014-10-21 16:16 -0700
              Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-22 08:38 +0300
                Re: Flush stdin Chris Angelico <rosuav@gmail.com> - 2014-10-22 17:23 +1100
              Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-22 13:57 +0300
            Re: Flush stdin random832@fastmail.us - 2014-10-22 11:01 -0400
              Re: Flush stdin Marko Rauhamaa <marko@pacujo.net> - 2014-10-22 18:28 +0300

csiph-web