News for hackers. Stuff that matters.
Re:Untyped Python: The Python That Was by jwmoz on Saturday December 02, 2023 @04:24PM (#38502180)
Fake typing in python was a terrible idea I can't believe got merged in. The initial version where you had to import new typing classes was particularly ugly. Now it is mitigated somewhat with as you would expect builtin type hints.

The worst thing for me is I have to work with javascript devs that can also do python and they incessantly use python type hinting because they come from typescript.

It's useless, clutters up the code and decreases readability.

Re:Untyped Python: The Python That Was by qayxc on Saturday December 02, 2023 @04:44PM (#38502336)
Funny. I have the exact opposite experience. Type hints tell me what the code actually does and what kind of arguments functions and methods actually expect.

It's all sunshine and rainbows if you work with well documented libraries, but there are tons of python libs out there that just use *kwargs as their function signatures with maybe - if you're lucky - a list of actual keywords (no types or description though).

Those are hell to work with, because the IDE can't tell you what's going on. So you either have to delve into sample code (and hope that's still up-to-date) or look at the source code to figure out what the heck is going on.

So no, I personally don't find type hints useless at all - especially for libraries. Readability OTOH is subjective and mostly just a matter of what you're used to, anyway.

Re:Untyped Python: The Python That Was by smitty1e on Saturday December 02, 2023 @04:45PM (#38502343)
> It's useless, clutters up the code and decreases readability.

I submit that dataclasses refute these claims handily.