Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete print() format, lack support of "%.02f" #493

Closed
Turnkeys opened this issue Jul 26, 2023 · 2 comments
Closed

Incomplete print() format, lack support of "%.02f" #493

Turnkeys opened this issue Jul 26, 2023 · 2 comments

Comments

@Turnkeys
Copy link

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
>>>
@adonovan
Copy link
Collaborator

adonovan commented Aug 7, 2023

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.

@Turnkeys
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants