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
Numeric operator predecence confusing #60642
Comments
http://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex "All numeric types (except complex) support the following operations, sorted by ascending priority." It list '-' after '+', '/' after '*'. That is to mean '-' has higher precedence than '+'. That is wrong, and is contradicting with here: http://docs.python.org/3/reference/expressions.html#summary This should be made clear. |
Precedence ordered per row. Same row, same precedence. I don't see any problem. It is natural math precedence. Closed as invalid. |
I mean the text at the first link need fix. '+' and '-' are not on the same row. And the doc says: "sorted by ascending priority", that means they have ascending priority. The table in the reference is just right. |
You are right, Yongzhi Pan. Reopening. Not sure how to solve it. Delegating to docs@python. |
I was trying to fix this, but I ran into a couple questions.
|
One possible solution: We do not list priorities of the operations, instead link to the precedence table in the language reference. |
Good idea. |
You could look at Doc/library/unittest.rst, there are some tables that span multiple lines. If you want a newline in the output too I think you have to add a blank line in the cell. |
That document actually doesn't have any table that spans multiple lines. Here's the html page: http://docs.python.org/dev/library/unittest.html Actually, I already know how to make a table span multiple lines from this stackoverflow page: http://stackoverflow.com/questions/13504595/multi-line-table-cell-in-restructuredtext However, the problem is having the items in different columns match, as it depends on the width of the table, which is not fixed. For example, notice how the table is formatted nicely here: http://imgur.com/y1hLg This is particularly problematic because some elements in the table have long lines. |
I find the numeric operator predecence simply wrong, not confusing, so +1 from me for applying the attached patch from ktt3ja. It's as simple as possible but no simpler :) |
Any progress on this? |
I agree that linking to the precedence table is probably the best solution. A different option would be to add an extra column listing the "priority" and rank the priorities of the different operations. |
I'm actually thinking perhaps the "see :ref:`operator-summary`" clause should be separate and under Notes below the table, as opposed to current PR:
reads oddly to me. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: