Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dict.__ne__ doesn't return NotImplemented #108

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

Closed
HyeockJinKim opened this issue Sep 30, 2019 · 0 comments · Fixed by #109
Closed

Dict.__ne__ doesn't return NotImplemented #108

HyeockJinKim opened this issue Sep 30, 2019 · 0 comments · Fixed by #109

Comments

@HyeockJinKim
Copy link
Contributor

Dict.ne doesn't return NotImplemented.

gpython/py/dict.go

Lines 167 to 176 in af17d7d

func (a StringDict) M__ne__(other Object) (Object, error) {
res, err := a.M__eq__(other)
if err != nil {
return nil, err
}
if res == True {
return False, nil
}
return True, nil
}

If result of __eq__ is Not Implemented, __ne__ should return NotImplemented, not True

Expected result (python)

>>> a = {}
>>> a.__ne__(3)
NotImplemented

Actual result (gpython)

>>> a = {}
>>> a.__ne__(3)
True
HyeockJinKim added a commit to HyeockJinKim/gpython that referenced this issue Sep 30, 2019
if type of other is not dict,
return NotImplemented

Fixes go-python#108
@ncw ncw closed this as completed in #109 Oct 8, 2019
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 a pull request may close this issue.

1 participant