Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary operators #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

isaacimholt
Copy link
Contributor

added __add__ and __iadd__

@gruns
Copy link
Owner

gruns commented May 1, 2019

__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')])?

@isaacimholt
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants