6 ms·
I encourage every one to at least stop writing code in Python.
by koakuma-chan 1y ago
I encourage every one to at least stop writing code in Python.
- jvanderbot 1y agoThe benefits realized can be mostly attributed to strong type checking. I'm a rust dev full time. And I agree with everything here. But I also want people to realize it's not "Just Rust" that does this. In case anyone gets FOMO.
- koakuma-chan 1y agoDo you know a language other than Rust that has alternative for docs.rs? In JavaScript and Python they never bother to have any documentation or reference, one notable example that gets me frustrated these days is the openai SDK for TypeScript. There is no documentation for it. I have to go look at the source code to figure out what the hell goes on.
- 9question1 1y agoThese days isn't the solution to this just "ask <insert LLM of choice here>" to read the code and write the documentation"?
- koakuma-chan 1y agoYes, you can have Claude Code go through the code and make an .md file with documentation for all the public APIs. I do that for everything that doesn't provide llms.txt.
- bigstrat2003 1y agoIf you want to not reliably know anything about the code, sure. But if you want to have useful knowledge, using a stochastically unreliable tool isn't going to cut it.
- cbm-vic-20 1y agojavadoc.io is similar to (but not as good as) docs.rs for the Java ecosystem. It pulls the JavaDoc out of packages that are published to the Maven Central repository. It doesn't have good discoverability like docs.rs, though, and it's dependent on the publishers actually including the javadoc files.
- love2read 1y agojavadoc.io is similar in the fact that it lists things I guess? It looks worse (objective) but is also depended on a lot less so is just by default going to be a second thought. It’s also not auto-generated like docs.rs like you said.
- wolvesechoes 1y ago> In JavaScript and Python they never bother to have any documentation or reference Please, main Python libraries have much richer docs than almost anything from Rust ecosystem.
- veber-alex 1y agoHere is some actual useful advice: Use a type checker! Pyright can get you like 80% of Rust's type safety.
- kragen 1y agoWhat are the major pros and cons of Pyright and Mypy relative to one another?
- koakuma-chan 1y agoI don't agree that Python can be saved by a type checker. The language itself is flawed irreversibly, as well as its ecosystem. It's a big big mess. Can't build reliable software in Python.
- dkdcio 1y agoyou can and this is a juvenile position. there is reliable software in any language as popular and widespread as Python. every language is flawed
- IshKebab 1y ago> every language is flawed But not equally flawed. https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallacy-of-gray https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallac...
- grep_it 1y agoIs this rage-bait? A language alone doesn't dictate reliability. There are tons of large scale systems out there running on Python. As for the language being, "flawed irreversibly", I'd be curious to hear you expand on that with examples.
- nicce 1y agoAll programming languages are Turing complete and you can arque with that. But you reach similar results with varying pre-knowledge and effort. Sometimes it is even impossible. All programs can be bug-free but most are not, if we reverse the argument.
- nilslindemann 1y agoPeople who recommend that other people stop using one of the best documented languages on the planet with a huge library ecosystem, a friendly user base, a clean syntax, excellent reference documentation, intuitive function names, readable tracebacks, superb editor and AI support.
- love2read 1y agowhat language are you referring to here?
- nilslindemann 1y agoPython. https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/ https://pypl.github.io/PYPL.html https://pypl.github.io/PYPL.html https://www.statista.com/statistics/793628/worldwide-developer-survey-most-used-languages/ https://www.statista.com/statistics/793628/worldwide-develop... https://redmonk.com/sogrady/2024/03/08/language-rankings-1-24/ https://redmonk.com/sogrady/2024/03/08/language-rankings-1-2...
- ironmagma 1y agoIntuitive function names like __new__() and __init__()? Or id() and pickle.dumps()? The accessibility of Python is overrated. It's a language with warts and issues just like the others. Also the lack of static typing is a real hindrance (yes I know about mypy).
- mixmastamyk 1y agoDunders keep them out of the public namespace on purpose.
- frabcus 1y agoIt doesn't solve all the problems at library boundaries, but pyright is fairly new and vastly vastly better than mypy. With it Python feels about at the type safety level of Typescript - not as good as a language that had types the whole time, but much much better than nothing if enforced with strict rules in CI.
- lynndotpy 1y agoPythons power is in the REPL. It's good for when you want to do something ad-hoc that's too much for Bash or a graphing calculator. It has a large enough ecosystem that you can make a PoC for basically anything in a day. It's really, really good for <1000 LoC day projects that you won't be maintaining. (And, if you're writing entirely in the REPL, you probably won't even be saving the code in the first place.)
- love2read 1y agothe problem is that when you write enough <1kloc projects, a couple of them are useful enough to stay used in which case you are now maintaining python in prod.
- hnaccount_rng 1y agoYes but the alternative is "not having those projects at all" not "having them in a 'better' language"
- love2read 1y agoOf course not, the alternate is writing these projects in a more maintainable language
- noisy_boy 1y agoOr writing them in whatever language gets you going quickly and rewrite the "successful" ones in a more safe language like Rust. Of course write test cases for those ones first and then use LLM help to migrate them, including tests, to a safer language. Problem happens when the velocity of changes is too much and/or there is no appetite for migration - those are a different category of problem. The ideal scenario is what you are saying but most of the time it boils down to deadline vs familiarity/skill (of the developer and the team) trade-off.
- lynndotpy 1y agoI don't think that's inevitable, you can just not do that. I've been doing this for 15 years and it hasn't happened to me.
- voidUpdate 1y agoWhat language do you recommend instead for the type of small tasks I write python to solve? Needs to have a good image manipulation library, tools for manipulating binary data and converting it to normal types, good list comprehension tools, the ability to easily be a web client or server and a good REPL
- koakuma-chan 1y agoBun
- voidUpdate 1y agoisnt that just javascript?
- koakuma-chan 1y agoIt's JavaScript (TypeScript) that ships as a single executable with lots of stuff in it like bundler, compiler, postgres client, etc. I use it for scripting, e.g., seed database, etc.
- lmm 1y agoIf you're willing to put a bunch of up-front effort into learning it first, Haskell. If not, OCaml.