Operator: inappropriate wording?

Weatherby,Gerard gweatherby at uchc.edu
Wed Oct 26 16:10:37 EDT 2022


No. If the docs say in one place a comma is not an operator, they shouldn’t call it an operator in another place.

I’ve submitted a pull request https://github.com/python/cpython/pull/98736 -- we’ll have to see what The Powers That Be think.

From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of elas tica <elasstiika at gmail.com>
Date: Wednesday, October 26, 2022 at 3:32 PM
To: python-list at python.org <python-list at python.org>
Subject: Operator: inappropriate wording?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

Quotes from The Python Language Reference, Release 3.10.8:

- Note that tuples are not formed by the parentheses, but rather by use of the comma operator (p. 66)
- Note: If the object is a class instance and the attribute reference occurs on both sides of the assignment operator (p. 86)
- The second half of the list, the augmented assignment operators, serve lexically as delimiters, but also perform an operation (p. 15)



Do you agree with this use of the term "operator"?

Because there is no such "comma operator" in Python as explained by the official FAQ: https://urldefense.com/v3/__https://docs.python.org/3/faq/programming.html*what-s-up-with-the-comma-operator-s-precedence__;Iw!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeWVu5edfg$<https://urldefense.com/v3/__https:/docs.python.org/3/faq/programming.html*what-s-up-with-the-comma-operator-s-precedence__;Iw!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeWVu5edfg$>

And, =, += and the like are not operators since (a=b), (a+=b), etc have no value. There is no assignment operator instead there exists an assignment statement. The only assignment operator I can figure out is the walrus operator. To confirm, The Python Language Reference gives here:

https://urldefense.com/v3/__https://docs.python.org/3/reference/lexical_analysis.html*operators__;Iw!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeVnKYO3BA$<https://urldefense.com/v3/__https:/docs.python.org/3/reference/lexical_analysis.html*operators__;Iw!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeVnKYO3BA$>

the set of tokens considered as operator and the =, += tokens are not listed whereas := is.
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeW3iNHD7g$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!nL9TZBaXZH87JOWNN7D_3E0ytfdXH8tkUxvTdF4dXbVqOJS0yF0C7idVg4ZGee7FiFyPQqqNRcNeVeW3iNHD7g$>


More information about the Python-list mailing list