| ▲ | pansa2 3 hours ago |
| AFAICT Python basically is a [statically-]typed language nowadays. Most people are using MyPy or an alternative typechecker, and the community frowns on those who aren’t. |
|
| ▲ | embedding-shape 3 hours ago | parent | next [-] |
| > Most people are using MyPy or an alternative typechecker, and the community frowns on those who aren’t. That's not like a widespread/by-default/de-facto standard across the ecosystem, by a wide margin. Browse popular/trending Python repositories and GitHub sometime and I guess you can see. Most of the AI stuff released is still basically using conda or pip for dependencies, more times than not, they don't even share/say what Python version they used. It's basically still the wild west out there. Never had anyone "frown" towards me for not using MyPy or any typechecker either, although I get plenty of that from TS fans when I refuse to adopt TS. |
| |
| ▲ | pansa2 3 hours ago | parent | next [-] | | > Never had anyone "frown" towards me for not using MyPy or any typechecker either I’ve seen it many times. Here’s one of the more extreme examples, a highly-upvoted comment that describes not using type hints as “catastrophically unprofessional”: https://www.reddit.com/r/Python/comments/1iqytkf/python_type... | | |
| ▲ | embedding-shape 3 hours ago | parent [-] | | But yeah, that's reddit, people/bots rejoice over anything being cargoculted there, and you really can't take any upvote/downvote numbers on reddit seriously, it's all manipulated today. Don't read stuff on reddit and use whatever you've "learned" there elsewhere, because it's basically run by moderators who try to profit of their communities these days, hardly any humans left on the subreddits. Edit: I really can't stress this enough, don't use upvotes/likes/stars/whatever as an indicator that a person on the internet is right and has a good point, especially not on reddit but I would advice people to not do so on HN either, or any other place. But again, especially on reddit, the upvotes literally count for nothing. Don't pick up advice based on upvoted comments on reddit! |
| |
| ▲ | __MatrixMan__ 3 hours ago | parent | prev | next [-] | | Generally you only get frowned at if you're not using type hints while contributing to a project whose coding standards say "we use type hints here." If you're working on a project that doesn't use type hints, there's also plenty of frowning, but that's just because coding without a type checker is kind of painful. | | |
| ▲ | embedding-shape 3 hours ago | parent [-] | | > Generally you only get frowned at if you're not using type hints while contributing to a project whose coding standards say "we use type hints here." Yeah, that obviously makes sense, not following the code guidelines of a project should be frowned upon. |
| |
| ▲ | shadowgovt 3 hours ago | parent | prev [-] | | I think in the case of TS, it's more that JavaScript itself is notoriously trash (I'm not being subjective; see https://www.destroyallsoftware.com/talks/wat), and TypeScript helps paper over like 90% of the holes in JavaScript. Python typed or untyped feels like a taste / flexibility / prototyping tradeoff; TypeScript vs. JavaScript feels like "Do you want to get work done or do you want to wrap barbed wire around your ankle and pull?" And I say this as someone who will happily grab JS sometimes (for <1,000 LOC projects that I don't plan to maintain indefinitely or share with other people). Plus, TypeScript isn't a strict superset of JavaScript, so choice at the beginning matters; if you start in JS and decide to use TS later, you're going to have to port your code. | | |
| ▲ | embedding-shape 3 hours ago | parent [-] | | Typed Python vs untyped Python is literally the same as TS vs JS, don't let others fool you into thinking somehow it's different. > TypeScript helps paper over like 90% of the holes in JavaScript Always kind of baffles me when people say this, how are you actually programming where 90% of the errors/bugs you have are related to types and other things TS addresses? I must be doing something very different when writing JS because while those things happen sometime (once or twice a year maybe?), 90% of the issues I have while programming are domain/logic bugs, and wouldn't be solved by TS in any way. |
|
|
|
| ▲ | shadowgovt 3 hours ago | parent | prev [-] |
| It's a pretty nice best-of-both-worlds arrangement. The type information is there, but the program still runs without it (unless one is doing something really fancy, since it does actually make a runtime construct that can be introspected; some ORMs use the static type data to figure out database-to-object bindings). So you can go without types for prototyping, and then when you're happy with your prototype you can let mypy beat you up until the types are sound. There is a small nonzero cost to using the types at runtime (since they do create metadata that doesn't get dropped like in most languages with a static compilation step, like C++ or TypeScript). I can name an absolute handful of languages I've used that have that flexibility. Common LISP comes to mind. But in general you get one or the other option. |
| |
| ▲ | pansa2 3 hours ago | parent [-] | | > It's a pretty nice best-of-both-worlds arrangement It’s also a worst-of-both-worlds arrangement, in that you have to do the extra work to satisfy the type checker but don’t get the benefits of a compiled language in terms of performance and ease-of-deployment, and only partial benefits in terms of correctness (because the type system is unsound). AFAIK the Dart team felt this way about optional typing in Dart 1.x, which is why they changed to sound static typing for Dart 2. | | |
| ▲ | 9rx an hour ago | parent [-] | | Without dependent typing, it's the worst of all worlds anyway. You have to express types, but they aren't expressive enough to not have to also express the same in tests, leaving this weird place where you have to repeat yourself over and over. That was an okay tradeoff for humans writing code as it enables things like the squiggly line as you type for basic mistakes, automatic refactoring, etc. But that stuff makes no difference to LLMs. |
|
|