Yes, this has all basically been hashed in the other thread that was linked. my post there was my best attempt at summarizing what is missed by the current formatting options with respect to “signficant figure” display.
Note that I think there is some confusion when it comes to significant figures. There is one notion that has to do with rounding and one that has to do with uncertainty and error propagation.
I patently dismiss the utility of significant figures for uncertainty and error propagation. Significant figures are a BAD WAY to communicate uncertainty. If you care about uncertainty you should simply report the mean value of your measurement together with a confidence interval (often a symmetric one- or two-sigma confidence interval). E.g. 8.3 +/- 0.3. The obvious flaw with using the number of significant figures for display is that, unless you are strictly using scientific notation, you cannot tell by inspection how many “significant figures” a number has. For example, is 100 shown with 1, 2 or 3 significant figures?
However, it IS useful to be able to round to a number of significant figures independent of their poor use for uncertainty tracking. By this I mean the following. To round to 3 significant figures is to round to the second decimal place below the top decimal place. So 123456.789 rounded to 3 significant figures is of course 123000. Of course 123000 would appear the same whether we round to 3, 4, 5 or 6 significant digits but I don’t care. Why should I? It’s just specifying a decimal place to which to round. However, if we round to 7 significant digits I would display that as 123000.0.
One case where this is useful is if this number is part of a value/uncertainty pair. We could display 123456.789 +/- 789.987 but many of these digits are uninteresting. We usually only care about one or two digits of the uncertainty. so we would round the uncertainty to, say, two significant figures. We also want to round the value to the same decimal place resulting in 123460 +/- 790. This is a case where I want rounding according to sig figs but I also might happen to want fixed point notation.
So I will continue to say that I think better significant figure rounding in python string/number formatting would be valuable to me and others. There are some blind spots with the current string formatting options.
I’ve developed a pypi package called sciform that allows for clear significant figure rounding. With that package you can do something like
from sciform import SciNum
n = SciNum(123456.789)
print(f"{n:!2f}")
# 120000
See some of the documentation for some decisions I made differently for the sciform FSML compared to the python built-in FSML.
The main difference I want to highlight is that I remove the g format specifier which seems to be a weird historical hodge podge of options that are occasionally convenient for numerical display. But the g option makes a lot of decisions under the hood that are not really easy to understand without a lot of thought. sciform instead gives the user explicit control over the different aspects of number formatting they might be interested in. For example the user can select significant figure or digits-past-the-decimal rounding independent from their choice to use fixed point, scientific, or engineering notation.