On Thu, May 30, 2019 at 11:00:41AM +1200, Greg Ewing wrote:
Steven D'Aprano wrote:
The obvious solution to customising assignment is to use a dotted target:
obj.x = value
Another problem with this is that we don't want to customise all assignments. Sometimes we just want a regular Python assignment. (See my previous post about two different kinds of assignment.)
I think that talking about this in terms of "customising assignment" is misleading and is causing a lot of confusion.
You might be right, but then the first first post in this thread talked about it:
I realize there is no way to overload the behavior of the assignment operator in python ... where signal = 5 will always make signal to be 5, instead of feeding 5 into this signal.
(the second being a bad thing) so I'm pretty sure that using a new assignment-like operator instead of = is the OP's second choice.