Operator: inappropriate wording?

Roel Schroeven roel at roelschroeven.net
Wed Oct 26 15:59:10 EDT 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



More information about the Python-list mailing list