Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Gotcha, you snot-necked weenies!" -- Post Bros. Comics


devel / comp.lang.python / Re: tail

SubjectAuthor
o Re: tailChris Angelico

1
Re: tail

<mailman.364.1652129240.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18211&group=comp.lang.python#18211

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: tail
Date: Tue, 10 May 2022 06:47:06 +1000
Lines: 33
Message-ID: <mailman.364.1652129240.20749.python-list@python.org>
References: <CABbU2U8u-arOsEO=JfRUPeNQS68TYWVUYHvp6StiNpp_xaotZQ@mail.gmail.com>
<YnijKH0NJdtDd2sa@cskk.homeip.net>
<CABbU2U8iThoCk9M0agJMqAFDq0A9hzY5kQUMW=Jm5C94NkP28Q@mail.gmail.com>
<CAPTjJmqNNrk2gjN4=nX-Ai5Y1ysd4rsWGdyfU8Aqt1=Y1_Z-cQ@mail.gmail.com>
<CABbU2U-TLMLnWSJgOK6a8LaWWrwk+kcs801-_L=Wr2ijrLAdvQ@mail.gmail.com>
<CAPTjJmojCT9YYs4tXW0R-v8Hu7EtL5dXC2dpZppN9-8e58ZEzw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de av3reCIdsuO964ACbtgQcg22GZdqjALSRvG6krlvElKA==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=lZdbntd3;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2022': 0.05; 'absolute':
0.05; 'variable': 0.05; 'thing.': 0.07; 'angelico': 0.09;
'anyway,': 0.09; 'byte': 0.09; 'fundamental': 0.09; 'language,':
0.09; 'received:209.85.221.43': 0.09; 'received:mail-
wr1-f43.google.com': 0.09; 'arbitrary': 0.16; 'barry': 0.16;
'cameron': 0.16; 'characters.': 0.16; 'chrisa': 0.16; 'encoding':
0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'impossible': 0.16; 'inspect': 0.16; 'mean.': 0.16; 'reliable,':
0.16; 'simpson': 0.16; 'stdlib': 0.16; 'stream.': 0.16;
'toolkit.': 0.16; 'wrote:': 0.16; "can't": 0.17; 'solve': 0.19;
'tue,': 0.19; 'to:addr:python-list': 0.20; 'code': 0.23;
'command': 0.23; 'cannot': 0.25; 'binary': 0.26; 'function': 0.27;
'chris': 0.28; "doesn't": 0.32; 'do.': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'there': 0.33; 'core':
0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'files': 0.36; 'mon,': 0.36; "it's":
0.37; 'received:209.85': 0.37; 'file': 0.38; 'way': 0.38; 'means':
0.38; 'received:209': 0.39; 'text': 0.39; 'handle': 0.39; 'still':
0.40; 'best': 0.61; "there's": 0.61; 'mode': 0.62; 'here': 0.62;
'your': 0.64; 'tool': 0.65; 'worked': 0.67; 'reliable': 0.74;
'handles': 0.76; 'mode,': 0.76; 'seek': 0.81; 'characters': 0.84;
'decent': 0.84; 'performance.': 0.84; 'sulla': 0.84; 'reliable.':
0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=rBRyWhO+BGLxf+VkXYhRi38qwHKe0UuUBZapKeXr8p8=;
b=lZdbntd3uNY/smT3D1AEMZ9oYObV73KYFyBYTk1Vjtf3z0dWPVsaBCdAwoO9Dt1N6X
viRqN8+Sw1MakPaXEh4bw7TbaHh2wJjDrZCgEMoNFIIxvqDYEgHwS2+dqu2orGNB3XMq
6zclX6Cadq4cwSzkZ0AogxdpRJ0mw/wm7+maok8v4OcN3J7AyrsTPYnL2KueYMUJVKgz
v1T4mgbQ+vpIbnHiR3uC6wlsnq9QOmREiOfysMsFtVcflTjQVRi/uC1HHYc0abpVzuHv
65P/KEKKCqm+LJ82MfRvdI+1dy+WIg7qZCqRNc4T6birbMSzbBahDwrpIKRphGZX6ymd
v0lw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=rBRyWhO+BGLxf+VkXYhRi38qwHKe0UuUBZapKeXr8p8=;
b=N7/Mu+MPfVAlPcb31aNM7xooi8nDHAX9VimKXeKdkIZWZYmNfzrVn3LLADVNextlgB
WGg6yQ2qhrt128LlXeB0czDFnu2tz7ulHRo/5yayLlxCHbledV8GlyOM56j/RjauXFRz
mVy1I/AHvfIiegbybga4huMsnSqm9havwqQKt7ThFzSJsZ+860siZEmUxKFZJHb6Tumz
zqqhESxiQKQ56P/rG/vPr705XqOdiYRWMYj1b52PRk9JGWLaBHDHdxIq4dmo7aG6J2It
NlNarl7Yn3Zj0Iktos1XQeMVa+JiZ7Y1XFYn66eCFxnrCchZn8mS4nJ7XBORYC8b9Lc9
fT+Q==
X-Gm-Message-State: AOAM533ya7TaQF2i2mB+5P4+XNZDa5e8jUQ1FFRRanv3igboKINdlIpP
/n4mOYiMsbsdBXEAWWXqmLEyAOGh37E+PRDL5sL8flSB
X-Google-Smtp-Source: ABdhPJw+Sbm2sdzljrjxRMXUkXnMqNf6S/pc6KBdQFX0AVI6a16BGcZ8vLvsvDI2S3cduycHL2bTHh+vJQMoV4nFB3o=
X-Received: by 2002:a05:6000:1549:b0:20c:7183:439 with SMTP id
9-20020a056000154900b0020c71830439mr15810804wry.104.1652129238293; Mon, 09
May 2022 13:47:18 -0700 (PDT)
In-Reply-To: <CABbU2U-TLMLnWSJgOK6a8LaWWrwk+kcs801-_L=Wr2ijrLAdvQ@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <CAPTjJmojCT9YYs4tXW0R-v8Hu7EtL5dXC2dpZppN9-8e58ZEzw@mail.gmail.com>
X-Mailman-Original-References: <CABbU2U8u-arOsEO=JfRUPeNQS68TYWVUYHvp6StiNpp_xaotZQ@mail.gmail.com>
<YnijKH0NJdtDd2sa@cskk.homeip.net>
<CABbU2U8iThoCk9M0agJMqAFDq0A9hzY5kQUMW=Jm5C94NkP28Q@mail.gmail.com>
<CAPTjJmqNNrk2gjN4=nX-Ai5Y1ysd4rsWGdyfU8Aqt1=Y1_Z-cQ@mail.gmail.com>
<CABbU2U-TLMLnWSJgOK6a8LaWWrwk+kcs801-_L=Wr2ijrLAdvQ@mail.gmail.com>
 by: Chris Angelico - Mon, 9 May 2022 20:47 UTC

On Tue, 10 May 2022 at 05:12, Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
>
> On Mon, 9 May 2022 at 19:53, Chris Angelico <rosuav@gmail.com> wrote:
> >
> > On Tue, 10 May 2022 at 03:47, Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
> > >
> > > On Mon, 9 May 2022 at 07:56, Cameron Simpson <cs@cskk.id.au> wrote:
> > > >
> > > > The point here is that text is a very different thing. Because you
> > > > cannot seek to an absolute number of characters in an encoding with
> > > > variable sized characters. _If_ you did a seek to an arbitrary number
> > > > you can end up in the middle of some character. And there are encodings
> > > > where you cannot inspect the data to find a character boundary in the
> > > > byte stream.
> > >
> > > Ooook, now I understand what you and Barry mean. I suppose there's no
> > > reliable way to tail a big file opened in text mode with a decent performance.
> > >
> > > Anyway, the previous-previous function I posted worked only for files
> > > opened in binary mode, and I suppose it's reliable, since it searches
> > > only for b"\n", as readline() in binary mode do.
> >
> > It's still fundamentally impossible to solve this in a general way, so
> > the best way to do things will always be to code for *your* specific
> > use-case. That means that this doesn't belong in the stdlib or core
> > language, but in your own toolkit.
>
> Nevertheless, tail is a fundamental tool in *nix. It's fast and
> reliable. Also the tail command can't handle different encodings?

Like most Unix programs, it handles bytes.

ChrisA


devel / comp.lang.python / Re: tail

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor