[issue43837] Operator precedence documentation could be more clear

2021-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

* Changed the table order to match norms.

* Not adding and for variables because that is outside the norm (likely because 
variables aren't operators).

* Keeping the existing terminology which is standard and historically hasn't 
been a problem.  Also the tone and level matches that for the rest of the 
reference guide.

Thank you all for your input.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 072ec69af592611f36349f5048569ab7e72b8b61 by Miss Islington (bot) 
in branch '3.9':
bpo-43837: Reverse order of precedence table to show tightly binding operators 
first (GH-25469) (GH-25472)
https://github.com/python/cpython/commit/072ec69af592611f36349f5048569ab7e72b8b61


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-19 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 10.0 -> 11.0
pull_requests: +24198
pull_request: https://github.com/python/cpython/pull/25472

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 68ba0c67cac10c2545ea3b62d8b161e5b3594edd by Ammar Askar in branch 
'master':
bpo-43837: Reverse order of precedence table to show tightly binding operators 
first (GH-25469)
https://github.com/python/cpython/commit/68ba0c67cac10c2545ea3b62d8b161e5b3594edd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Chris Jerdonek

Chris Jerdonek  added the comment:

> So maybe we should change the terminology while we’re at it.

When math is taught to elementary school students in the US, it's called "order 
of operations": https://en.wikipedia.org/wiki/Order_of_operations

Since this was raised in the context of newcomers to coding, it might be worth 
mentioning that parallel. Being able to connect to the familiar concepts of 
"first" and "last" might help people not familiar with precedence and binding.

--
nosy: +chris.jerdonek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Ammar Askar


Ammar Askar  added the comment:

Opened https://github.com/python/cpython/pull/25469 for the first suggestion of 
reversing the precedence table order since it seems like a good improvement. I 
think the tight binding to weak order is more natural and aside from K, the 
following other languages also follow the same ordering:

* Javascript - 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table
* PHP - https://www.php.net/manual/en/language.operators.precedence.php
* Rust - 
https://doc.rust-lang.org/reference/expressions.html#expression-precedence

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 8.0 -> 9.0
pull_requests: +24194
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25469

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Let's reverse the table in accordance with the de facto standard.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

I defer to Raymond on this. 

Honestly without looking at the website I don’t even recall whether “higher 
precedence” means “binds more tightly” or the opposite. :-) So maybe we should 
change the terminology while we’re at it.

--
nosy: +Guido.van.Rossum, rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

When I looked at the table yesterday (after several years), I was initially 
confused at the 'reversed' order (before I checked the text above).  Besides 
precedence usually (nearly always) being listed high to low*, the chapter 
itself is highest to lowest, so the table is reversed from the chapter order.

* I checked K C and several sites and images and all I saw had highest at the 
top (highest).  This include other Python charts.

The table has been this way since at least 1.4
https://docs.python.org/release/1.4/ref/ref5.html#HDR18
Guido, how would you feel about reversing it to follow what seems to be the de 
facto standard?

The header 'Operator' could be changed to 'Operator (lowest first)' but I would 
prefer to make that 'Operator (highest first)'.

--
nosy: +gvanrossum, terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-14 Thread Zachary Ware


Zachary Ware  added the comment:

I think it might be easiest to see your suggestion as a pull request :)

--
nosy: +zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-14 Thread Aidan Feldman


Aidan Feldman  added the comment:

Let me try and say a simpler way: I think "variables" should be mentioned in 
that section, either in the table or the paragraph above.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-14 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> There isn't any mention of variables. While not operators, probably worth 
> mentioning that they (effectively?) have higher precedence than any of the 
> operators.

I'm sorry, I don't understand what that means.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-13 Thread Aidan Feldman


New submission from Aidan Feldman :

I am teaching a class on Python for people who are new to coding, and I was 
talking them through the operator precedence table:

https://docs.python.org/3/reference/expressions.html#operator-precedence

A couple things that confused the students:

- "Highest precedence" is on the bottom, while "lowest precedence" is on top
- There isn't any mention of variables. While not operators, probably worth 
mentioning that they (effectively?) have higher precedence than any of the 
operators.

I'd be happy to try making my first contribution to Python if there's interest 
in those edits. Also, I have an example breaking down operator precedence in 
practice here, which I could include:

https://colab.research.google.com/github/afeld/python-public-policy/blob/main/lecture_2.ipynb#scrollTo=UTxeT5RvqSFl

Thanks!

--
assignee: docs@python
components: Documentation
messages: 391030
nosy: aidan.feldman, docs@python
priority: normal
severity: normal
status: open
title: Operator precedence documentation could be more clear
type: enhancement
versions: Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com