5 ms·
Python is great but typed python is awful. But getting type hints and type checking would be great. That and pythons package management chaos that is somehow ev
by sureglymop 3y ago
Python is great but typed python is awful. But getting type hints and type checking would be great. That and pythons package management chaos that is somehow even worse than npm are the main pain points imo.
- giancarlostoro 3y agoI'm really confused, Python has type hints. It's had type hints for a while now? At least several years. As for package managers, I have run into woes with pip, but most of my gripes are when Debian or Ubuntu have their own versions of packages that are on pip. I rely on venv to save me there though. For the most part pip is fine, I'm not sure I've tried other package managers. Edit: Python 3.5 is where type hints were introduced, this was released in 2015, so nearly 9 years ago.
- phailhaus 3y agoIt's not that it doesn't have type hints, it's that they're really bad. Python decided to introduce the syntax for type hints before developing a type checker (which is still not officially supported). This means that the type system is filled with weird gaps that 3rd party typechecking libraries can't fix without breaking changes to the language itself. For example, `TypedDict` didn't support optional keys until Python 3.11, and even then you have to use the clunky `NotRequired` type to pull it off. This is despite the fact that having optional kwargs has been a common pattern for decades. The type system is also not particularly robust. You can't make a class similar to `dataclasses.dataclass` yourself and have it typecheck propertly, so libraries like Pydantic have to develop custom plugins for typecheckers like mypy to get themselves to work.
- giancarlostoro 3y agoAh I see, so you want it improved upon to better align with what has always been available to actually be represented by the option type system, I can agree with that. I'll be honest, I have not used it extensively, I'm used to just doing Python the old way, maybe once its been fully refined and becomes the status quo I'll dive into it. Until then, if I want types I just use a typed language.
- deleted 3y ago[deleted]
- falcor84 3y agoIf you think typed Python is awful, try typed Ruby