-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Update documentation's "Prints" comments after #47502 #99081
Update documentation's "Prints" comments after #47502 #99081
Conversation
I think your original notes are still correct. If you're bothering to add a comment with the expected output, it should match the actual output. I'm also not sure this decreases readability. In some other contexts (like shaders), adding the explicit |
I have to say it somewhat impacts readability when multiple Vector types are involved (see the PR itself). This readability issue is somewhat similar to what this user brought up. Problematic examples include:
Note that one solution could also be to rework the examples to mitigate this issue, outright. |
Of the examples in your last comment, only the polygon example seems unreadable to me, since it's a long line. In the other examples, a single vector print on each line seems fine. But then again I've been mostly working with shader examples where floats always use In general, I think accuracy should be prioritized, since these comments are presumably used to check your work when you copy-paste an example. Some readability loss is acceptable for that, IMO. I don't feel all that strongly about this, though. Making an exception for vectors, or just overall not caring about matching the exact output, is also a reasonable choice. |
7435e43
to
b9a8142
Compare
Addressed the above review across the board. |
print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) | ||
print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) | ||
print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # Prints [(0, 0), (1, 1), (2, 2), (3, 3), (3, 4)] | ||
print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # Prints [(0, 0), (16, 16), (32, 32), (48, 48), (48, 64)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to the PR but it looks like an obvious oversight.
b9a8142
to
d90f045
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we're sticking with the trailing zero format for floats, so this style checks out
Thanks! |
See:
To make it brief,
print(a) # Prints {value}
is a very common way in the class reference to represent a result. What follows it needs to be precisely what is printed in the console. This is not always the case, but it's a pretty consistent rule.For transparency, my own notes on these kinds of comments is as follows:
However, since #47502, whole floating-point numbers are always converted and printed with the trailing
.0
, making many of these comments inaccurate.Although this is technically an error, this PR is worth debating about, as it actually makes readability worse in a vast majority of cases.
Either these comments are mostly fine as they are, we make a special exception just for Vectors, or we go ahead and always favour pure accuracy to not confuse the user.