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


Groups > comp.lang.python > #79413

Re: Flush stdin

Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; '22,': 0.09; 'dan': 0.09; 'false.': 0.09; 'tests,': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'merged': 0.16; 'sockets': 0.16; 'tcp': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '(but': 0.19; '>>>': 0.22; 'input': 0.22; 'cc:addr:python.org': 0.22; 'affects': 0.24; 'byte': 0.24; 'bytes': 0.24; 'certainly': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'developers': 0.25; 'header:In-Reply-To:1': 0.27; 'related': 0.29; "doesn't": 0.30; 'important.': 0.30; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'with,': 0.31; 'becomes': 0.33; 'maybe': 0.34; 'could': 0.34; "can't": 0.35; 'something': 0.35; 'no,': 0.35; "who's": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'doing': 0.36; 'should': 0.36; 'application': 0.37; 'two': 0.37; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'show': 0.63; 'soon': 0.63; 'our': 0.64; 'provide': 0.64; 'more': 0.64; 'series': 0.66; 'between': 0.67; '20,': 0.68; 'actually,': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=aolLC6JIw2sG8505i2WXJDShYSgUezXmmyw2EFP1w+A=; b=cUBYx2aN1bFkru8IEHtpkZ77LnRGdZim+gV/78qyH0kv/4Gp4nAbKdwwMIU0ykwoxZ 0E6IJluFTIsaUQd4+2iB+fMs7LDKvDKNpHKgH9zvXInnx9KXWW/x2CxqxtTwDtR0fM7d YkG5X/zPtqBKz3E59sGnEa7fRsm0bmV4sVB2yBgt8BJTH6epZK4usaq0VwcyKVz0PABn G8vwyJmqHmBOOeu50T0x8OhXB04IAzUTGqg1gi8NZpHLj0hbPb7H2o5c3sxaEvZDygVA j+WNgiIVAHm3pyX1m3RhTwmSuiIcLKgM8Ga12f/wkAGYc7fBO+6AtJBdLEVZ6WR78iwT no2A==
MIME-Version 1.0
X-Received by 10.50.60.97 with SMTP id g1mr32591837igr.2.1413958995171; Tue, 21 Oct 2014 23:23:15 -0700 (PDT)
In-Reply-To <871tq0fyun.fsf@elektro.pacujo.net>
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> <mailman.15049.1413933396.18130.python-list@python.org> <871tq0fyun.fsf@elektro.pacujo.net>
Date Wed, 22 Oct 2014 17:23:15 +1100
Subject Re: Flush stdin
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.15055.1413959003.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413959003 news.xs4all.nl 2965 [2001:888:2000:d::a6]:54228
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:79413

Show key headers only | View raw


On Wed, Oct 22, 2014 at 4:38 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Dan Stromberg <drsalists@gmail.com>:
>
>> On Mon, Oct 20, 2014 at 9:41 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
>>> Nagle affects the communication between the peer OS kernels and isn't
>>> directly related to anything the application does.
>>
>> Actually, Nagle can cause two or more small packets to be merged,
>> which is something an application must be able to deal with, because
>> they could show up in the receiving application as one or more (but
>> anyway: fewer) merged recv()'s.
>
> Packets have barely anything to do with TCP sockets since they provide
> an octet stream abstraction.

TCP does abstract over the individual packets, but they are still important.

>> Of course, but who's doing one byte per second?  You and I in our
>> tests, and perhaps some application developers with remarkably
>> undemanding I/O.  That doesn't really mean we should _recommend_ a
>> series of os.read(0, 1)'s.
>
> No, here's my statement: if you need to process input as soon as it
> becomes available, you can't use sys.stdin. Instead, you need to use
> os.read().
>
> You typically supply os.read() with a buffer of a kilobyte or more. Key
> is, os.read() returns right away if fewer bytes are available.

Then your statement is false. Maybe it's not *efficient* if you always
use sys.stdin.read(1), but you certainly can do it. It's not that you
*need to* use something else.

ChrisA

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