I am reading a tutorial about python, it's lexical structure to be more precise. And I just want to know why in Python, the:
+= , -= , *= , /= , //= , %=, <= , |= , ^= , >>= , <<= , **=
are considered as delimiters and not operators? After all, the "+=" is an increment operator, right?
The syntax you refer to are used in augmented assignment statements. Like regular assignment, these are not expressions, so they are not operators either.
They happen to closely resemble certain arithmetic operators, but only in that they fall back to using those operators if the assignment target does not implement a specific augmented assignment special method for the operation.
Delimiters are tokens that do not require whitespace around them in source code, which is why those tokens are listed in that list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With