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
Date 2021-12-06.12:03:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638792226.95.0.292604366656.issue45995@roundup.psfhosted.org>
In-reply-to
Content
proposal: add a string formatting option to normalize negative 0 values to 0

use case:  rounded display of a float that is nominally 0, where the distraction of a flashing minus sign from minute changes around 0 is unwanted

example:
>>> '%~5.1f' % -.00001
'  0.0'

format spec before:
  format_spec     ::=  [[fill]align][sign][#][0][width][grouping_option][.precision][type]
after:
  format_spec     ::=  [[fill]align][sign][~][#][0][width][grouping_option][.precision][type]
  where '~' is only allowed for number types

implementation: if '~' is present in the spec, add 0 to the value after applying precision
History
Date User Action Args
2021-12-06 12:03:47John Belmontesetrecipients: + John Belmonte
2021-12-06 12:03:46John Belmontesetmessageid: <1638792226.95.0.292604366656.issue45995@roundup.psfhosted.org>
2021-12-06 12:03:46John Belmontelinkissue45995 messages
2021-12-06 12:03:46John Belmontecreate