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


Groups > comp.lang.python > #79412

Re: Flush stdin

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 <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: Flush stdin
Date Wed, 22 Oct 2014 08:38:24 +0300
Organization A noiseless patient Spider
Lines 28
Message-ID <871tq0fyun.fsf@elektro.pacujo.net> (permalink)
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>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="3443"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sV7jfiZEMEjWrJaBpIV5j"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:NVaCbhO7xUDJHFq+302Uu3zn2qA= sha1:DilHHmmBX7Wh7c93Ku9AKbA+pw4=
Xref csiph.com comp.lang.python:79412

Show key headers only | View raw


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.

> 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.


Marko

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