3 ms·
I'm a heavy user of type hints and enable pyright and mypy's strict modes whenever possible. However, you can't always be strict: if you use almost any package
by maleldil 4y ago
I'm a heavy user of type hints and enable pyright and mypy's strict modes whenever possible. However, you can't always be strict: if you use almost any package in the data science/ML ecosystem, you're unlikely to get good type inference and checking[1]. In those cases, it can still be useful to type some parameters and return values to benefit from _some_ checking, even if you don't have 100% coverage.
Type hints also bring improved completion, which is nice too.
[1] For example, huggingface's transformers library decided to drop support for full type checking because it was unsustainable but decided to keep the types for documentation[2]. There are stubs for pandas, but they're not enough because pandas has a tendency to change return types based on the input, and that breaks quickly.
[2] https://github.com/huggingface/transformers/pull/18485 https://github.com/huggingface/transformers/pull/18485
- Jeff_Brown 4y ago> There are stubs for pandas, but they're not enough because pandas has a tendency to change return types based on the input, and that breaks quickly. A mechanism like Haskell's type application seems like it could solve at least most, maybe all of those problems.
- ParetoOptimal 4y agoI can confirm from experience using Frames[0] and type applications together this is very much the case. 0: https://hackage.haskell.org/package/Frames https://hackage.haskell.org/package/Frames