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


Groups > comp.lang.python > #79282

Re: Flush stdin

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'socket': 0.07; 'cc:addr :python-list': 0.11; 'python': 0.11; 'flush': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'cc:addr:python.org': 0.22; 'print': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'asked': 0.31; 'question:': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'work?': 0.38; 'pm,': 0.38; 'read': 0.60; 'worry': 0.60; 'high': 0.63; 'account': 0.65; '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=JabRpAfJW3TVV6FUZ03VEd1FxziohC4hnEb/QTR1Lco=; b=UHaAcsXKiApPDH3jjyUEv1/1mcpFc15kwy3vl5dS+1J+kwPzMP35uueyOdjrp2CdjZ rERCzv54iBS5pzyNlAGGcRZe5CSR4GmZaoTKq9ghspvc3uSSGeW8A1rPoomn/Z0Zw9CF bJwDWa5ko5VyC48GP9XL3mX/bg4g6Lt0K4QXBFvAVsKDiF5sbPIPpv9bu1x2RglwPaAq zDen2G76n/7tlK8t4I+BdasyMxjF4Yw36n+eWboSxXRI6DPDQKssFm7wwYL9iE98oxHr qJTtJ9QE5eVrjos4JtJCVPemOt6ooSHW9xTUmEhQf2HXkudIz3R3aUnXXObwVcD0BFVI CRHA==
MIME-Version 1.0
X-Received by 10.107.164.129 with SMTP id d1mr18995274ioj.37.1413681780641; Sat, 18 Oct 2014 18:23:00 -0700 (PDT)
In-Reply-To <CABcP1UeH9ft0j++HbUpHDDWz4i=7eJrDU=kVXFN6LPHT3oNE6Q@mail.gmail.com>
References <CABcP1UeH9ft0j++HbUpHDDWz4i=7eJrDU=kVXFN6LPHT3oNE6Q@mail.gmail.com>
Date Sun, 19 Oct 2014 12:23:00 +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.14976.1413681789.18130.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413681789 news.xs4all.nl 2883 [2001:888:2000:d::a6]:48636
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79282

Show key headers only | View raw


On Fri, Oct 17, 2014 at 10:38 PM, Empty Account <emptya45@gmail.com> wrote:
> I am using netcat to listen to a port and python to read stdin and print to
> the console.
>
> nc -l 2003 | python print_metrics.py

After lengthy discussion about what it means to flush stdin, I think
it's high time someone asked the question: Why not skip nc altogether,
and have your Python program do its own socket work? Then you don't
have to worry about stream flushing at all.

ChrisA

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


Thread

Re: Flush stdin Chris Angelico <rosuav@gmail.com> - 2014-10-19 12:23 +1100

csiph-web