Skip to content

BUG: Operator equal supports void and np.equal does not #9147

@eric-wieser

Description

@eric-wieser
>>> x = np.array([(0, 1, 0)] * 10, dtype=[('f0', '<i4'), ('f1', '<i4'), ('f2', '<i4')])
>>> x == x
array([ True,  True,  True,  True,  True,  True,  True,  True,  True,  True], dtype=bool)
>>> np.equal(x, x)
FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
NotImplemented

Presumably this has ramifications for users overloading __array_ufunc__ with @shoyer's mixin class, causing operations to fail on structured dtypes - as these do not pass through ndarray.__eq__, which seems to special case things to make them work

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions