[Python-ideas] The @update operator for dictionaries
Jonathan Fine
jfine2358 at gmail.com
Sat Mar 9 11:43:18 EST 2019
Chris Angelico suggested that
a = a.update_with(b)
would be better than
a @update= b
One of the key points of += is that
parent.child['toy'].wheel[3].speed += 1
increases the speed that that wheel by 1, without having to write
parent.child['toy'].wheel[3].speed = parent.child['toy'].wheel[3].speed + 1
To answer Chris's other points. It not me, but Chris and Steve who
want to bind dict.update to an operator, namely '+'. I'm suggested
that if you do that, why not call the operator 'update'.
Finally, we don't yet have any real idea how much difficulty the
grammar change would cause.
--
Jonathan
More information about the Python-ideas
mailing list