Incomplete print() format, lack support of "%.02f"
Turnkeys opened this issue · comments
Python:
Python 3.11.3 (main, May 3 2023, 23:19:07) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print("%.02f" % (1/3))
0.33
>>> print("%f" % (1/3))
0.333333
>>>
Starlark:
Welcome to Starlark (go.starlark.net)
>>> print("%.02f" % (1/3))
Traceback (most recent call last):
<stdin>:1:15: in <expr>
Error: unknown conversion %.
>>> print("%f" % (1/3))
0.333333
>>>
I agree that this would be a good change, and that it was the original Starlark implementation shouldn't have skipped over this feature, though to be fair the need for precision control over numeric formatting rarely seems to arise in build system-like applications, and it can be safely added later.
But this change to the behavior of the % operator must be proposed to the Starlark spec first, not to any one of its implementations. Could you report this issue in the bazelbuild/starlark repo? Thanks.
I agree that this would be a good change, and that it was the original Starlark implementation shouldn't have skipped over this feature, though to be fair the need for precision control over numeric formatting rarely seems to arise in build system-like applications, and it can be safely added later.
But this change to the behavior of the % operator must be proposed to the Starlark spec first, not to any one of its implementations. Could you report this issue in the bazelbuild/starlark repo? Thanks.
OK. Thanks! bazelbuild/starlark#262