The general answer to all questions about "why was this language feature not implemented" is that the team who designed the language decided that the benefit didn't outweigh the cost.
Cost can take many forms. It takes time and effort to implement a language feature, but there is also the intrinsic cost of complexity: does the feature make the language more complex or ambiguous, out of proportion to its potential benefit?
The hypothetical operator does something fundamentally different from the other compound assignment operators. While the other operators are purely mathematical in nature, this one is different: it substitutes one value for another (in the context you described).
Given this ambiguity (the operator performs two different functions, depending on context), it's not difficult to see why it was not included in the language. Although you state that changing
to perform null coalescing is a valuable feature, the benefit is far less clear to me. If value substitution is to occur, it seems logical (and clearer) to have both values on the right side of the equals sign, to provide a visual indication that such substitution may occur.
C# took a different path, and uses a specific operator for null coalescing.
All python variables are bindings to some objects in memory.
- Does this code do anything?
Yes, it does. Actually it creates a new object in memory with new name.
- How does ) differ from ?
By assignment you are getting different names for the same object. So if you are really need a you should use or copy.
So and have same , while has different.
Quote from docs about and copy:
The difference between shallow and deep copying is only relevant for compound objects (objects that contain other objects, like lists or class instances):
A shallow copy constructs a new compound object and then (to the extent possible) inserts references into it to the objects found in the original.
A deep copy constructs a new compound object and then, recursively, inserts copies into it of the objects found in the original.