
March 21, 2019
5:42 p.m.
Steven D'Aprano wrote:
But if you have *concrete examples* of code that currently is easy to understand, but will be harder to understand if we add dict.__add__, then please do show me!
# What does this do? >>> items. update(points) # And what does this do? >>> items += points What did you get? Here's one possible context. >>> Point = namedtuple('Point', ['x', 'y']) >>> p, q, r = Point(1,2), Point(3, 4), Point(5, 6) >>> points = set([p, q, r]) >>> points {Point(x=1, y=2), Point(x=5, y=6), Point(x=3, y=4)} >>> items = dict(a=4, b=8) -- Jonathan