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 Jakub Szewczyk
Recipients Jakub Szewczyk, eric.smith
Date 2018-06-01.12:42:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527856953.25.0.682650639539.issue33731@psf.upfronthosting.co.za>
In-reply-to
Content
.2f produces a string representation of a float rounded up to 2 significant digits.

>>> print ("{:.2f}".format(1.891))
1.89

However, it does not respect locale. There is no counterpart of 'f' that would respect locale. There is 'n', but because it follows the rules of 'g', in many cases it returns a different number of significant digits. 

>>> print ("{:.2n}".format(1.891))
1.9


In all my uses of formatted float printing, I need to produce floats that are rounded to have the same number of significant digits. I _presume_ this generalizes to the majority people, and the use of 'f' option is much more widespread than the use of 'g'. If this is the case, then a locale-friendly counterpart of 'f' would be very useful.
History
Date User Action Args
2018-06-01 12:42:33Jakub Szewczyksetrecipients: + Jakub Szewczyk, eric.smith
2018-06-01 12:42:33Jakub Szewczyksetmessageid: <1527856953.25.0.682650639539.issue33731@psf.upfronthosting.co.za>
2018-06-01 12:42:33Jakub Szewczyklinkissue33731 messages
2018-06-01 12:42:33Jakub Szewczykcreate