4 ms·
I'm not. There are still huge issues with it that Typescript and other statically typed languages don't have: 1. No way to fully type `args` and `kwargs` which
by IshKebab 4y ago
I'm not. There are still huge issues with it that Typescript and other statically typed languages don't have:
1. No way to fully type `args` and `kwargs` which are sadly common in Python code.
2. Type semantics aren't defined so there are multiple competing interpretations. Not great if your dependencies use one type checker and you use a different one. Not that that will matter because...
3. A depressingly huge part of the Python community doesn't get static typing so a ton of your dependencies won't have types.
4. The most popular type checker - MyPy - is full of bugs and deliberate unsoundness. Pyright is much better but also newer so lots of projects don't use it.
I definitely wouldn't choose Python if I had a choice.
- davidatbu 4y ago> No way to fully type args and kwargs I think "parameter Specification Variables"[0] come pretty close to solving that no? I'd love to hear your take if you've used them before. > Type semantics aren't defined so there are multiple competing interpretations > The most popular type checker - MyPy - is full of bugs and deliberate unsoundness. 100% agreed. I hope Pyright "wins" as the dominant type checker, because like you said, it's MUCH better in every aspect. > A depressingly huge part of the Python community doesn't get static typing so a ton of your dependencies won't have types. 100%. I have so many half hearted attempts at typing my dependencies![1] > I definitely wouldn't choose Python if I had a choice. At this point, I'd have to agree, except of course for data science/ML things. [0] https://peps.python.org/pep-0612/ https://peps.python.org/pep-0612/ [1] https://github.com/davidatbu?tab=repositories&q=stubs&type=&language=&sort= https://github.com/davidatbu?tab=repositories&q=stubs&type=&...
- ptx 4y agoOne aspect of Pyright that seems decidedly not better is the 651 NPM dependencies [1] it apparently drags along. [1] https://github.com/microsoft/pyright/blob/main/package-lock.json https://github.com/microsoft/pyright/blob/main/package-lock....
- davidatbu 4y agoFair point (in regards to security). Regarding ease-of-install though, installing pyright is painless in comparison to installing mypy when dealing with virtual envs, IMO.
- IshKebab 4y ago> parameter Specification Variables I think that's unrelated. Seems to be something that's only for Callables.
- davidatbu 4y agoThen I think the issue you're talking about is actually addressed by variadic generics, for the case of typing `*args` [0] [0] https://peps.python.org/pep-0646/#args-as-a-type-variable-tuple https://peps.python.org/pep-0646/#args-as-a-type-variable-tu...
- IshKebab 4y agoAh yeah that looks like it works for `args`. Unfortunately the issues is way more common with `kwargs`. :-/
- davidatbu 4y agoIt looks like there's a PEP for **kwargs already! [0] And as (almost) always, Pyright has already implemented the provisional PEP! [0] https://github.com/python/peps/pull/2620 https://github.com/python/peps/pull/2620