Skip to content

DType parent class / type alias #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarcoGorelli opened this issue Jun 28, 2023 · 0 comments
Closed

DType parent class / type alias #189

MarcoGorelli opened this issue Jun 28, 2023 · 0 comments
Labels
static typing type annotations, use of type checkers directly from the spec

Comments

@MarcoGorelli
Copy link
Contributor

MarcoGorelli commented Jun 28, 2023

Also splitting this off from #187 (comment)

We have various dtypes: Int64, Int32, ...., Bool, which are part of the API.

We have functions which accept any dtype, such as

def column_from_sequence(sequence: Sequence[Scalar], *, dtype) -> Column:

How do we type dtype? I originally wanted to have DType be a common superclass of the dtypes, so we could have

def column_from_sequence(sequence: Sequence[Scalar], *, dtype: DType) -> Column:

but it's been brought up that this isn't desirable because it would add a class to the namespace for the sole purpose of type checking.

Are there alternatives which would be acceptable?

@rgommers rgommers added the static typing type annotations, use of type checkers directly from the spec label Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
static typing type annotations, use of type checkers directly from the spec
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants