• Operator: inappropriate wording?

    From elas tica@21:1/5 to All on Wed Oct 26 12:01:04 2022
    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://docs.python.org/3/faq/programming.html#what-s-up-with-the-comma-operator-s-precedence

    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://docs.python.org/3/reference/lexical_analysis.html#operators

    the set of tokens considered as operator and the =, += tokens are not listed whereas := is.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to elas tica on Wed Oct 26 19:23:50 2022
    elas tica <elasstiika@gmail.com> writes:
    Do you agree with this use of the term "operator"?

    When a language specification says that something
    is an operator, it is an operator (unless there are
    contradictions). Such a definitions is not an
    opinion one can agree with or not agree with.

    Because there is no such "comma operator" in Python as
    explained by the official FAQ

    Language specifications take precedence over FAQs.
    FAQs may be simplified somewhat to also apply to
    beginners. For pedagogical reasons, authors of text
    books also may use some terms differently from the
    language specification. For practical programming
    purposes one does not always have to use terms
    strictly as defined in the language specification.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roel Schroeven@21:1/5 to elas tica on Wed Oct 26 21:59:10 2022
    elas tica schreef op 26/10/2022 om 21:01:
    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"?
    It's a bit fuzzy, I guess. Comma, =, +=, *= etc. are in section 2.6 "Delimiters" and not in section 2.5 "Operators" of The Python Language Reference, which would seem to imply that those are not operators. But
    the text in section 2.6 then says "The second half of the list, the
    augmented assignment _operators_, serve lexically as delimiters, but
    also perform an operation.", so at least the augmented assignment
    operators are seen as operators despite not being in the Operators section.

    Because there is no such "comma operator" in Python as explained by the official FAQ: https://docs.python.org/3/faq/programming.html#what-s-up-with-the-comma-operator-s-precedence
    That does seem to contradict the text in the language reference.
    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.
    I think that's a good point too. The language reference calls those
    things 'delimiters', which doesn't feel like a good description either
    for many of them. I find it weird to think of =, *+, +=as a delimiter.
    Maybe that's why those things are called operators anyway instead of
    delimiters in many places? Things like "Note: If the object is a class
    instance and the attribute reference occurs on both sides of the
    assignment _delimiter_" sound a bit weird I feel, even though completely correct according to the language reference.

    So yeah I think you have a point that the terminology regarding those
    tokens is not very consistent at the least.

    --
    "Honest criticism is hard to take, particularly from a relative, a friend,
    an acquaintance, or a stranger."
    -- Franklin P. Jones

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Weatherby,Gerard@21:1/5 to All on Wed Oct 26 20:10:37 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@python.org> on behalf of elas tica <elasstiika@gmail.com>
    Date: Wednesday, October 26, 2022 at 3:32 PM
    To: python-list@python.org <python-list@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$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From elas tica@21:1/5 to All on Mon Oct 31 14:09:26 2022
    Le mercredi 26 octobre 2022 à 22:12:59 UTC+2, Weatherby,Gerard a ecrit :
    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.


    Thanks for the (merged) pull request about the "comma operator"!

    I return to the last two quotes in the Reference Document regarding these so-called "assignment operators".

    The entry in the glossary explains that the comma symbol is not an operator. Well, I just realized that this same entry also explains that the = symbol is not an operator, as you can see by reading the end of their response:

    The same is true of the various assignment operators (=, += etc). They are not truly operators but syntactic delimiters in assignment statements.

    (glossary entry link: https://docs.python.org/3/faq/programming.html#what-s-up-with-the-comma-operator-s-precedence)

    Talking about an assignment operator in Python is even more confusing because, since Python 3.8, there is a real assignment operator, namely the walrus operator. As explained above, the correct expression would be "assignement delimiter" or "assignement
    statement" or "assignement symbol".


    By the way, Alex Martelli shares this view, explaining:

    The "=" operator in Python ... doesn't exist, since '=' is not an operator in Python (just like it isn't, say, in VB). But, OK, you mean "assignment".

    (source: https://groups.google.com/g/comp.lang.python/c/K6HfK6HANR4/m/OG9QBzFmTR8J)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to elas tica on Tue Nov 1 08:18:23 2022
    On Tue, 1 Nov 2022 at 08:15, elas tica <elasstiika@gmail.com> wrote:

    Le mercredi 26 octobre 2022 Ă  22:12:59 UTC+2, Weatherby,Gerard a ecrit :
    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.


    Thanks for the (merged) pull request about the "comma operator"!

    I return to the last two quotes in the Reference Document regarding these so-called "assignment operators".

    The entry in the glossary explains that the comma symbol is not an operator. Well, I just realized that this same entry also explains that the = symbol is not an operator, as you can see by reading the end of their response:

    The same is true of the various assignment operators (=, += etc). They are not truly operators but syntactic delimiters in assignment statements.

    (glossary entry link: https://docs.python.org/3/faq/programming.html#what-s-up-with-the-comma-operator-s-precedence)

    Talking about an assignment operator in Python is even more confusing because, since Python 3.8, there is a real assignment operator, namely the walrus operator. As explained above, the correct expression would be "assignement delimiter" or "
    assignement statement" or "assignement symbol".


    Wording is hard. Just ask the SQL standard whether NULL is a value.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From elas tica@21:1/5 to All on Wed Nov 2 15:22:57 2022
    Le lundi 31 octobre 2022 à 22:18:57 UTC+1, Chris Angelico a ecrit :
    Wording is hard. Just ask the SQL standard whether NULL is a value.


    Indeed, but I think our problem here is simpler ;)

    One could for example omit the incorrect term "operator" while remaining unambiguous. This would give:

    If the object is a class instance and the attribute reference occurs on both sides of the assignment, the right-hand side expression,...

    Now, as for the other formulation from the reference document:

    The second half of the list, the augmented assignment operators, serve lexically as delimiters, but also perform an operation.

    (link: https://docs.python.org/3/reference/lexical_analysis.html#delimiters)

    it is incorrect (as explained by the FAQ I quoted in my last post) and the explanations it gives are even more incorrect suggesting that anything that performs an operation is the result of the action of an operator. Under these conditions, we could say
    that del is an operator and even that return is an operator!


    I opened an issue on the CPython GitHub repository, here: https://github.com/python/cpython/issues/98814

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to elas tica on Sat Nov 5 02:28:54 2022
    On Thu, 3 Nov 2022 at 10:17, elas tica <elasstiika@gmail.com> wrote:

    Le lundi 31 octobre 2022 Ă  22:18:57 UTC+1, Chris Angelico a ecrit :
    Wording is hard. Just ask the SQL standard whether NULL is a value.


    Indeed, but I think our problem here is simpler ;)

    One could for example omit the incorrect term "operator" while remaining unambiguous. This would give:

    Yep. The word "operator" is incorrect when referring to Python's comma
    (in contrast to, say, C, where the comma actually *is* an operator);
    and from my understanding, the docs have already been updated to fix
    this.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From elas tica@21:1/5 to All on Fri Nov 4 13:46:56 2022
    Le vendredi 4 novembre 2022 à 16:29:34 UTC+1, Chris Angelico a écrit :

    Yep. The word "operator" is incorrect when referring to Python's comma
    (in contrast to, say, C, where the comma actually *is* an operator);
    and from my understanding, the docs have already been updated to fix
    this.

    ChrisA

    Thanks Chris for your response.

    This problem of an imaginary comma operator was quite clear. The issue I opened is more about the so-called = operator which is not considered as such by the official Python FAQ, at the same place where it was said that comma was not an operator either.

    By the way, I opened another issue because the dot operator is missing in the list of tokens that are operators and R. Hettinger seems to consider my objection as admissible. The issue is here: https://github.com/python/cpython/issues/99000

    It seems that there are some problems with the use of the term operator in the official documentation ;)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)