Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

This file will self-destruct in five minutes.


devel / comp.lang.python / Re: tail

SubjectAuthor
o Re: tailCameron Simpson

1
Re: tail

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

 copy mid

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

 copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: tail
Date: Fri, 13 May 2022 08:29:13 +1000
Lines: 49
Message-ID: <mailman.389.1652394565.20749.python-list@python.org>
References: <CABbU2U9HHADoY9ysgtoBtPnyu7UEaozCayuRRbc7UaVZPnvCLw@mail.gmail.com>
<Yn2KOYsmP0Zce8GT@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de k4s1CJZuYaiVXN2rpPjf0gPuIFNU1V7YVuZqLAiiH4OA==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '2022': 0.05; 'pypi': 0.05;
'ram': 0.07; 'cases.': 0.09; 'describe': 0.09; 'repo': 0.09;
'cheers,': 0.11; '"find': 0.16; '(b)': 0.16; 'appended': 0.16;
'arbitrary': 0.16; 'cameron': 0.16; 'default.': 0.16; 'encoding':
0.16; 'encoding,': 0.16; 'ephemeral': 0.16; 'from:addr:cs': 0.16;
'from:addr:cskk.id.au': 0.16; 'from:name:cameron simpson': 0.16;
'inherently': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'purely':
0.16; 'received:13.237': 0.16; 'received:13.237.201': 0.16;
'received:13.237.201.189': 0.16; 'received:cskk.id.au': 0.16;
'received:id.au': 0.16; 'received:mail.cskk.id.au': 0.16;
'right.': 0.16; 'seen.': 0.16; 'simpson': 0.16; 'specify': 0.16;
'tasks.': 0.16; 'things:': 0.16; 'toolkit.': 0.16; 'wrote:': 0.16;
'problem': 0.16; 'github': 0.17; 'says': 0.17; "can't": 0.17;
'uses': 0.19; 'thu,': 0.19; 'to:addr:python-list': 0.20; 'maybe':
0.22; 'code': 0.23; 'lines': 0.23; 'cannot': 0.25; 'anyone': 0.25;
'stefan': 0.26; 'task': 0.26; 'function': 0.27; 'done': 0.28;
'output': 0.28; 'purpose': 0.28; 'header:User-Agent:1': 0.30;
'default': 0.31; 'think': 0.32; 'carefully': 0.32; 'but': 0.32;
'particular': 0.33; 'path': 0.33; 'someone': 0.34; 'package':
0.34; 'header:In-Reply-To:1': 0.34; 'particularly': 0.35;
'received:au': 0.35; 'possibly': 0.36; 'people': 0.36; 'special':
0.37; 'others': 0.37; 'though': 0.37; 'file': 0.38; 'way': 0.38;
'means': 0.38; 'least': 0.39; 'text': 0.39; 'use': 0.39; 'done.':
0.40; 'both': 0.40; 'should': 0.40; 'including': 0.60; 'provide':
0.60; 'search': 0.61; 'services': 0.61; "there's": 0.61;
'reasonable': 0.62; 'ever': 0.63; 'send': 0.63; 'personal': 0.64;
'explained': 0.64; 'received:13': 0.64; 'your': 0.64;
'received:userid': 0.66; 'numbers': 0.67; 'nearly': 0.67;
'latter': 0.69; 'obvious': 0.69; 'conditions': 0.70; 'free': 0.72;
'easy': 0.74; 'extra': 0.84; 'publish': 0.84; 'bitbucket,': 0.84;
'implies': 0.84; 'meaning.': 0.84; 'means,': 0.84; 'platforms.':
0.84; 'sulla': 0.84; 'yards': 0.84; 'dependent': 0.93; 'former':
0.93
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CABbU2U9HHADoY9ysgtoBtPnyu7UEaozCayuRRbc7UaVZPnvCLw@mail.gmail.com>
User-Agent: Mutt/2.2.3 (2022-04-12)
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: <Yn2KOYsmP0Zce8GT@cskk.homeip.net>
X-Mailman-Original-References: <CABbU2U9HHADoY9ysgtoBtPnyu7UEaozCayuRRbc7UaVZPnvCLw@mail.gmail.com>
 by: Cameron Simpson - Thu, 12 May 2022 22:29 UTC

On 12May2022 19:48, Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
>On Thu, 12 May 2022 at 00:50, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>> There's no spec/doc, so one can't even test it.
>
>Excuse me, you're very right.
>
>"""
>A function that "tails" the file. If you don't know what that means,
>google "man tail"
>
>filepath: the file path of the file to be "tailed"
>n: the numbers of lines "tailed"
>chunk_size: oh don't care, use it as is

This is nearly the worst "specification" I have ever seen.

Describe what your function _does_.

Do not just send people to an arbitrary search engine to find possibly
ephemeral web pages where someone has typed "man tail" and/or (if lucky)
web pages with the output of "man tail" for any of several platforms.

But this is sounding more and more like a special purpose task to be
done for your particular use cases. That says it should be in your
personal toolkit. If it has general applicability, _publish_ your
toolkit for others to use. You can do that trivially by pushing your
code repo to any of several free services like bitbucket, gitlab,
sourcehut, github etc. Or you can go the extra few yards and publish a
package to PyPI and see if anyone uses it.

Part of your problem is that you think the term "tail" has a specific
simple obvious meaning. But even to me it means at least 2 things:
- to report the last "n" "lines" of a text file
- to continuously report "new" data appended to a file

These are different, though related, tasks. The latter one is
particularly easy if done purely for bytes (on systems which allow it).
As you've had explained to you, the former task is actually very fiddly.

It is fiddly both in boundary conditions and complicated by being
dependent on the text encoding, which you do not inherently know - that
implies that you ought to (a) provide a way to specify that encoding and
(b) maybe have a reasonable fallback default. But that default needs to
be carefully and precisely explained. And the "find a line ending"
criteria need to be explained. And the "sync to a character boundary"
needs to be explained, including where it cannot be done.

Cheers,
Cameron Simpson <cs@cskk.id.au>

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor