Re: Is there a better way? [combining f-string, thousands separator, right align]

Liste des GroupesRevenir à cl python 
Sujet : Re: Is there a better way? [combining f-string, thousands separator, right align]
De : 2QdxY4RzWzUUiLuE (at) *nospam* potatochowder.com
Groupes : comp.lang.python
Date : 26. Aug 2024, 13:00:32
Autres entêtes
Message-ID : <mailman.9.1724670045.2917.python-list@python.org>
References : 1 2 3
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.

Date Sujet#  Auteur
26 Aug 24 o Re: Is there a better way? [combining f-string, thousands separator, right align]12QdxY4RzWzUUiLuE

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal