-
Notifications
You must be signed in to change notification settings - Fork 249
Fully (almost) type tools.py #847
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
Conversation
495ec95 to
3d7d45e
Compare
|
Found a way that avoids all the casting. Btw, given the choice between |
Nice! I thought of doing something like that too, but wasn't sure it would work :(
Hm, I usually went by "if I need to cast, it probably means I didn't narrow the types enough for the type checker" and tried to avoid it. Yours is probably a better way to look at it when gradually adding types to things. :-? |
Not claiming it's a good way! And gradual typing mostly doesn't factor into it for the most part. Just trying to make sense of when to use what. Here's a different restatement:
As a microbenchmark matter, the two have slightly different cost profiles, but I'm choosing to just regard both as "free", to avoid being pulled in spurious directions. |
|
Thx! |
I'll happily defer to your newly gained extensive experience in typing 😁
I can definitely agree with that! |
Inspired by all the new errors in #616, this adds types to pretty much everything in
tools.py(on a bit of a best effort basis, since some of them may be too strict). Some small-ish parts are still missing:get_gl_sharing_context_properties, mostly due to missing the OpenGL bindings.np.dtypedoesn't seem to like taking a dict (inmatch_dtype_to_c_struct), not sure why.makostill isn't typed and causing some small errors.cl.array.Array.datanot having the right type. This might just need some checking to make sure it's ok.