This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author John Belmonte
Recipients John Belmonte, eric.smith, mark.dickinson, serhiy.storchaka, steven.daprano
Date 2021-12-08.01:51:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638928318.97.0.611568298172.issue45995@roundup.psfhosted.org>
In-reply-to
Content
I'll share a draft PR soon (excluding Decimal), so far it's still looking straightforward.

> Maybe old versions would correctly ignore the new bit being set.

That's one of the benefits of using bit flags in an ABI: backward-compatible extensibility.  (An implementation can defeat it by intentionally failing if unknown bits are encountered, but the code in question doesn't appear to be doing this.)

> You can round explicitly before formatting
>
>    >>> '%5.1f' % (round(-.00001, 1) + 0.0)

Yes, I have experience with it.

  1. even as a one-off, it's questionable.  If someone accidentally changes the precision in only one of the spec string or round call, that's a bug.
  2. since applications and libraries may pass around format specs, and because of (1), you'll try to make a programmatic solution.  Now you're parsing format spec strings.
  3. while a programmatic solution can be done for a function API like format() that takes a separate spec and value, there is no sane way to wrap f-strings
History
Date User Action Args
2021-12-08 01:51:59John Belmontesetrecipients: + John Belmonte, mark.dickinson, eric.smith, steven.daprano, serhiy.storchaka
2021-12-08 01:51:58John Belmontesetmessageid: <1638928318.97.0.611568298172.issue45995@roundup.psfhosted.org>
2021-12-08 01:51:58John Belmontelinkissue45995 messages
2021-12-08 01:51:58John Belmontecreate