Skip to content

Unexpected behavior for **= when __numpy_ufunc__ is present. #7146

@lkilcher

Description

@lkilcher

I've been working on getting Pint ready for the new __numpy_ufunc__ functionality, but I've run into a snag.

I've done my best to document the issue in this gist. In particular, the issue is that when creating classes that are not ndarray, I can reproduce expected behavior using standard python special operators (e.g. __add__) when __numpy_ufunc__ is present. For example, myobj.__radd__ is called when I do an_ndarray += myobj. However, myobj.__rpow__ is not called when I do an_ndarray **= myobj. Can anyone explain to me why this is? Thanks.

This issue has arisen from this one: hgrecco/pint#326.

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