Skip to content

Dict.__ne__ doesn't return NotImplemented  #108

Closed
@HyeockJinKim

Description

@HyeockJinKim

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions