Deutsch English Français Italiano |
<mailman.9.1724670045.2917.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: 2QdxY4RzWzUUiLuE@potatochowder.com Newsgroups: comp.lang.python Subject: Re: Is there a better way? [combining f-string, thousands separator, right align] Date: Mon, 26 Aug 2024 06:00:32 -0500 Lines: 30 Message-ID: <mailman.9.1724670045.2917.python-list@python.org> References: <oRHyO.142039$bV6e.134076@fx08.ams4> <09102d57-41cd-4428-b96f-d69e2ffe9c95@DancesWithMice.info> <ZsxgUBEdOsVL6c49@anomaly> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de ACO/mNt40EELhHvREHp+PQ0sHLx/sFyaHptNUW3jS8wg== Cancel-Lock: sha1:TICZOzzz088gv124ZICCUaOEsKc= sha256:MF5tPg+ej0FdRDaygluWT85KXEuFO3EoSVA0vOTIiM4= Return-Path: <2QdxY4RzWzUUiLuE@potatochowder.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=potatochowder.com header.i=@potatochowder.com header.b=C43jfDgw; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '(for': 0.05; ';-)': 0.07; 'users,': 0.07; 'received:78': 0.09; 'subject:, \n ': 0.09; 'from:addr:2qdxy4rzwzuuilue': 0.16; 'from:addr:potatochowder.com': 0.16; 'okay,': 0.16; 'parsing': 0.16; 'received:136.243': 0.16; 'received:78.46': 0.16; 'received:78.46.172': 0.16; 'received:www458.your-server.de': 0.16; 'received:your-server.de': 0.16; 'rpg': 0.16; 'subject:align': 0.16; 'subject:string': 0.16; 'subject:way': 0.16; 'wrote:': 0.16; "can't": 0.17; "aren't": 0.19; 'to:addr:python-list': 0.20; 'code': 0.23; 'url:wiki': 0.23; 'received:de': 0.23; 'actual': 0.25; 'do,': 0.26; "isn't": 0.27; '>>>': 0.28; 'settings': 0.28; 'default': 0.31; 'python-list': 0.32; 'received:136': 0.32; 'said,': 0.32; 'subject:there': 0.32; "i'll": 0.33; 'header:In-Reply-To:1': 0.34; 'files': 0.36; 'really': 0.37; 'file': 0.38; 'could': 0.38; 'added': 0.39; 'still': 0.40; 'want': 0.40; 'ever': 0.63; 'thus': 0.64; 'your': 0.64; 'back': 0.67; 'further': 0.69; 'subject:]': 0.70; 'url- ip:208.80.154/24': 0.70; 'url-ip:208.80/16': 0.70; 'url:wikipedia': 0.70; 'skip:f 30': 0.71; 'url-ip:208/8': 0.71; 'global': 0.73; "you'll": 0.73; 'apparent': 0.84; 'caused': 0.86; 'subject:better': 0.91; 'hole': 0.93 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=potatochowder.com; s=default2305; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=acL4G3x1LLYGFq/rYgYxJUcWGcivgcD2HwT2VNu1vfQ=; b=C43jfDgwCWdXaF0TrS9ivdyphT n57J+04DztrHn0TfBfFOdS07bZMTd5G7U80LLJo24tq2FY6FadXGuWgtWl6h6Ogd7LcLpfcCRaJlV 4POpugoTBjf6AXIf2ngwj5BP1jmhwiDvnvibHcD8WSjP/vSsBmk1DOL7E3MBLRmfpu5ePK5eEF755 duWLPDZo0mH4hPuOmbfwcE0R9OZZWwHX9yJX9TJRhsVi6gt4311UWNRgWuFpjDFC5E3poi4RBuTBn dllXMY8LoD0CWg+q862LesXqNqVw6Ah8R8SVL4ncOvNo2busSukt0osbZCw86aPicV3JVp3Y/oJT9 yvShXLVQ==; Mail-Followup-To: python-list@python.org Content-Disposition: inline In-Reply-To: <09102d57-41cd-4428-b96f-d69e2ffe9c95@DancesWithMice.info> X-Authenticated-Sender: 2QdxY4RzWzUUiLuE@potatochowder.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27379/Mon Aug 26 10:48:32 2024) 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: <ZsxgUBEdOsVL6c49@anomaly> X-Mailman-Original-References: <oRHyO.142039$bV6e.134076@fx08.ams4> <09102d57-41cd-4428-b96f-d69e2ffe9c95@DancesWithMice.info> Bytes: 5542 On 2024-08-26 at 20:42:32 +1200, dn via Python-list <python-list@python.org> wrote: > and if we really want to go over-board: > > >>> RIGHT_JUSTIFIED = ">" > >>> THOUSANDS_SEPARATOR = "," > >>> s_format = F"{RIGHT_JUSTIFIED}{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}" > > or (better) because right-justification is the default for numbers: > > >>> s_format = F"{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}" > > > To the extreme that if your user keeps fiddling with presentations (none > ever do, do they?), all settings to do with s_format could be added to a > config/environment file, and thus be even further separated from > program-logic! And then you'll need a parser, many of whose Unique Challenges™ aren't even apparent until you start parsing files from actual users, and you'll still need some sort of fallback in the code anyway for the case that s_format can't be parsed (for whatever reason). Isn't a config file what just caused the global CrowdStrike outage? ;-) That said, I understand that report generators are a thing, not to mention RPG (https://en.wikipedia.org/wiki/IBM_RPG). Okay, sorry; I'll just crawl back into the hole from whence I came.