Documents for accuracy do not mention the default value here if precision is omitted. I can only assume that it works that way because it does!
The docs provide the default precision for% f as 6 in the specification mini-language format here . Perhaps specifying accuracy with. and then, omitting the integer value, the interpreter assumes that it should be zero?
It can even behave differently on different translators. Interesting to find anyway :).
Interestingly, using str.format raises a good ValueError in my interpreter 2.7:
>>> f = 234.12345676 >>> "{:.f}".format(f) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Format specifier missing precision
source share