Skip to content

DOC: dtype optional argument to __array__ not included in custom container guide #15292

@jthielen

Description

@jthielen

In the Writing custom array containers guide, the signature for __array__ is given as

def __array__(self):

which does not include the optional dtype argument. If a container class implementer follows the signature in the guide (like I did in hgrecco/pint#953), it breaks functionality with libraries (such as matplotlib) that rely on being able to use the dtype argument.

Would it be reasonable to update the custom containers guide to include this optional argument, with an added example block to illustrate its use? If so, I can submit a PR.

xref hgrecco/pint#974, hgrecco/pint#975

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions