-
-
Notifications
You must be signed in to change notification settings - Fork 428
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
ImageSlice docstring needs updating #1355
Comments
I think there are two separate questions here:
For 1 my feeling is the codebase is nothing but a huge pile of symbols: variables, arguments, parameters, methods, functions, classes, modules, packages. To me introducing nicely-named symbols for types is just part of programming. And not doing so leads to repetitive bloated code that's hard to read and maintain. That said, I know some reasonable people feel the exact opposite, they feel that type aliases obscure things. For 2 the idea that the type should be different in both places seems crazy to me, as in you are telling the developer two different answers the same question. But the idea that it should be repeated identically in both places seems crazy too, as in it's pure duplication. The whole idea of tediously entering types into comment blocks which might get totally out of sync with the code seems like a bad idea. It must be vestigial from before type annotations existed? I think the numpydoc world is heading towards using type annotations as the single point of truth, but they have not made the transition yet: In both cases I'm happy to do whatever the project wants here. I think projects know their own unique needs and goals. However ideally we can set clear guidelines so in the future people can get the PR right the first time without as much discussion. |
I think there's just two concrete decisions to make for this PR:
And then decide in general when do we use type aliases and how do we document them? |
Finally revisiting this during my review of #1565. I would like to replace it with |
I got rid of the |
We don't have a specific style guide. However the Zen of Python (import this) is the overarching guide, and it states "explicit is better than implicit". (It also says "practicality beats purity". So some type definitions might be judged as necessary. In this case I don't think it was — it's a judgement call. And I acknowledge that! It just happens to be one that I feel strongly about.) |
📚 Documentation
See discussion here:
#1343 (comment)
Specifically, I object to using the type alias ImageConverter, and I strongly object to using it in the docstring. Additionally, the description of the argument should explain that any array -> array callable will work here.
The text was updated successfully, but these errors were encountered: