Skip to content

Improve DType.__repr__ and simplify __slots__ maintenance via metaclasses #3212

@FBruzzesi

Description

@FBruzzesi

In the last few PRs focused on improving dtypes there were a couple of comments that stud out as follow-ups:

  1. Improve dtypes __repr__ (see test: Add serde tests for DTypes #3205 (comment))
  2. Simplify __slots__ maintenance (see fix(expr-ir): Ensure only __slots__, and not __dict__ too #3201 and perf: Add __slots__ to all DTypes #3194 (comment))

Both these improvements can be achieved via a single metaclass.

I went ahead and started a branch (chore/dtype-meta) that mostly takes care of both, but it fails on typing (pyright is happy, mypy is not).

I will open a draft PR, but I am happy to keep this issue to discuss alternatives or reframe it if we need additional features

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