Re:Python's “Disappointing” Superpowers
by zerodensity on Wednesday February 01, 2023 @04:39PM
(#34618230)
Could you give an example of a type of application where typing is a hindrance?
Re:Python's “Disappointing” Superpowers
by randomluck040 on Wednesday February 01, 2023 @04:45PM
(#34618320)
Not a hindrance but I work with image data a lot. Usually what comes in is any kind of Numpy array and what comes out at the end is either statistics or a Numpy array. I try to type hint everywhere I can but I feel stupid doing so because all I do is work with arrays. Maybe I’m not proficient/knowledgeable enough though so take it with a grain of salt.
Re:Python's “Disappointing” Superpowers
by zerodensity on Wednesday February 01, 2023 @05:04PM
(#34618579)
If it's truly "any" kind of Numpy array typing won't help much there I agree.
But often it can be helpful to know the shape of the input and the shape of the output. Eg are we working with a 2D,3D or ND array.
Before 3.11 it was not simple (possible?) To type this. But https://peps.python.org/pep-0646/ makes it possible. If somewhat clunky on the definition side.
Re:Python's “Disappointing” Superpowers
by spookylukey on Wednesday February 01, 2023 @05:05PM
(#34618596)
I did a fairly detailed breakdown regarding the Python library Parsy: https://lukeplant.me.uk/blog/posts/python-type-hints-parsy-c...
This is not to make the general claim "Typing is a hindrance in parsing applications", or anything close. It's saying "the current static type system(s) available in Python would have made this Python library much worse".
Re:Python's “Disappointing” Superpowers
by arcturus17 on Wednesday February 01, 2023 @05:11PM
(#34618670)
I’m also part of the Python community and I use typing extensively. I find them useful for app development but also in scripting. There must be at least be a good dozen of us seeing the popularity of mypy, pyright and the fact that the language designers saw fit to add them, too.
Many people in the Python community simply aren't writing those kinds of applications. They're writing applications where typing is not a benefit, it's a hindrance, so they don't use it, and Python makes that easy.