Skip to content

ENH: Add __slots__ = () to NDArrayOperatorsMixin #22876

@fbunt

Description

@fbunt

Proposed new feature or change:

Currently, if any parent class in an inheritance chain does not define __slots__, then all subclasses allow dynamic attribute creation. Even if every subsequent subclass defines __slots__, attributes are still able to be added to instances.

It would be really nice if the NDArrayOperatorsMixin class defined __slots__ = (). This would allow subclasses to prevent dynamic attribute creation by also using __slots__. I don't think there is a downside to adding this and the upside is that subclasses could then choose to add slots of their own and prevent dynamic attribute creation.

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