You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just got an idea and wanted to ask what you think of it.
Python supports these neat little "type hints" for quite some time now, and they would really come in handy for reducing crashes when used in combination with linters.
PyCharm, VS Code and many other powerful IDEs come with strong, highly capable linters that scour through the code and look for inconsistencies. For example, if I'm looping over an array of strings AND dicts, but at some point in the code access a string subscript of the current element we're looping over, a linter would be able to catch that and one could add an if statement to prevent an exception before even running the code.
Now, in reality, stuff is often more complicated than that. In the case of Alpaca, a project with tens of thousands of lines of code, humans would quickly lose the full view and supervision on stuff. But linters won't.
My idea: how about I (and everybody else that wants to!) take my time to add type hints to the project? This would make linters work more effectively, and I (or everyone else who's interested) could go through the warnings generated.
This is great because:
it's fully backwards compatible to the current codebase
barely visible or annoying when reading, so nothing is re-coded from the ground up and everything is still at the same place
if you don't use a linter, that's fine, the code will run just like before
fixing all the automatically generated warnings could greatly reduce crashes of the app or catch bugs beforehand
it comes at practically zero cost and gives us the opportunity to use powerful CI/CD at some point in the future
when reading a standalone function or class, the type hints in the arguments or attributes would immediately give you an idea about what kind of data the function or class deals with, massively improving readability
As I've said, I'd be ready to work on this and fix the warnings, I just wanted to ask whether it's okay to add type hints. It could greatly help.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello there,
I just got an idea and wanted to ask what you think of it.
Python supports these neat little "type hints" for quite some time now, and they would really come in handy for reducing crashes when used in combination with linters.
PyCharm, VS Code and many other powerful IDEs come with strong, highly capable linters that scour through the code and look for inconsistencies. For example, if I'm looping over an array of strings AND dicts, but at some point in the code access a string subscript of the current element we're looping over, a linter would be able to catch that and one could add an if statement to prevent an exception before even running the code.
Now, in reality, stuff is often more complicated than that. In the case of Alpaca, a project with tens of thousands of lines of code, humans would quickly lose the full view and supervision on stuff. But linters won't.
My idea: how about I (and everybody else that wants to!) take my time to add type hints to the project? This would make linters work more effectively, and I (or everyone else who's interested) could go through the warnings generated.
This is great because:
As I've said, I'd be ready to work on this and fix the warnings, I just wanted to ask whether it's okay to add type hints. It could greatly help.
Best greets
Beta Was this translation helpful? Give feedback.
All reactions