John Belmonte <[email protected]> added the comment:
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 ---------- _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue45995> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
