News for hackers. Stuff that matters.
Re:Static Duck Typing in Python with Protocols by tyingq on Tuesday November 23, 2021 @01:29AM (#29315116)
I'm not an expert in either, but the difference doesn't seem dramatic to me. You can put type annotations in JS also and just use typescript in a way that's similar to MyPy. Adding types to either JS or Python seems "not free" to me. You pull in extra tools and syntax for either.
Re:Static Duck Typing in Python with Protocols by zbentley on Tuesday November 23, 2021 @01:48PM (#29321594)
In TypeScript, there's no* way to run your code without invoking the type checker, as it has to transpile TS to JS. While you can suppress/reduce the strictness of the checker, you can't avoid it entirely, and opting out takes work.

Python is the opposite; using type annotations for any sort of verification is opt-in exclusively, and not part of the language/runtime itself.

*Yes, there are some direct TS runtimes/compilers, but they aren't how the vast majority of TS code runs.