Skip to content
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

Add KernelType type annotation #72

Open
rlouf opened this issue Jul 7, 2022 · 0 comments
Open

Add KernelType type annotation #72

rlouf opened this issue Jul 7, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@rlouf
Copy link
Member

rlouf commented Jul 7, 2022

[W]e could really use some type annotations for arguments like this. I honestly don't know the exact form of a valid kernel type (other than that it's a callable of some sort), so this is one instance where the type info really helps. In order to figure this out, I would have to trace where it's used in this codebase, and/or guess and check.

A custom type (alias) that explicitly ties together the functions in this library that construct valid kernel arguments is really all that's necessary to answer basic questions, so there's no need to delve much deeper than KernelType = Callable[[...], ...]—although something like KernelType = NewType("KernelType", Callable[[...], ...]) might be better for maintaining the "this function takes/outputs acceptable kernels" information when the local variable name KernelType isn't present in context (e.g. some Mypy reporting).

Originally posted by @brandonwillard in #66 (comment)

@rlouf rlouf added the enhancement New feature or request label Jul 7, 2022
@brandonwillard brandonwillard added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants