Issue 16677: Hard to find operator precedence in Lang Ref. (original) (raw)
Python Language Reference, chapter 6 "Expressions".
The last section (6.15) of this is titled, "Summary". That title is misleading -- it is not really a summary of the "Expressions" chapter but rather, as the first sentence makes clear, a table of operator precedences. It is not really even a "summary" of operator precedences since some of the preceeding operator sections don't mention their precedence. And adding to the confusion, none of preceding sections even use the word precedence, referring instead to "binding" or "priority".
Operator precedences are something many users frequently look for frequently in a language reference and the lack of an Operator Precedence entry in the ToC makes this section hard to find.
There are no index entries for "operators/precedence" or "expressions/order of evaluation". There is an index entry for "evaluation order" but that points to a different section.
At a minimum, this section should have its title changed from "Summary" to "Operator Precedence" and get one or more index entries.
In other languages operator precedence is often described and indexed under "order of evaluation", often as a subindex of "expressions". In the Python reference, there is a very short section called, 6.14, "Evaluation Order" that immediately preceeds the Operator Precedence section. That section and the Operator Precedence section could be effectively combined into a single section.
I think it's better to keep the two sections separate, so I just changed the title from "Summary" to "Operator precedence". While I was at it I also fixed the markup in a few places in the section and noticed a mistake in the "Evaluation order" (reported in #16777). Regarding the index entries I don't see anything wrong with the current ones, but I'm not sure how they are supposed to work and I generally find Google more reliable than the Sphinx search.