orderedmultidict icon indicating copy to clipboard operation
orderedmultidict copied to clipboard

Binary operators

Open isaacimholt opened this issue 6 years ago • 2 comments

added __add__ and __iadd__

isaacimholt avatar Apr 28 '19 23:04 isaacimholt

__add__() and __iadd__() should use c.add(k, value=v) over c.set(k, value=v).

When I see this code

>>> omdict([(1, 'a')]) + omdict([(1, 'a')])
>>> [result]

I expect [result] to be

omdict([(1, 'a'), (1, 'a')])

not

omdict([(1, 'a')])

c.add(k, value=v) results in the former.

Do you expect omdict([(1, 'a')]) + [(1, 'a')] to yield omdict([(1, 'a')])?

gruns avatar May 01 '19 01:05 gruns

That's fair it doesn't really make sense like this, what symbol should set have? Just use | or another one?

isaacimholt avatar May 01 '19 01:05 isaacimholt