By contrast, using Rust makes it easy to force a readable coding style on yourself and others.
If you only work on <1000 line scripts, Python is a blast. If you work on projects with >1M LoC, it gets very hard to keep everything you need in your head if you want to understand code that other people have written.
You know what Rust looks like to me? Perl without the dollar signs. There's your write-only language, you just have it backwards.
- if it calls a function on `self`, where is it actually implemented?
- if you pass arguments, can they be mutated?
- can the function throw an exception?
you can't really answer this questions easily and I would argue answering them in Rust is much easier. Also because tooling for statically typed languages can derive much more than for dynamically typed languages.
But the article pretty clearly outlined a super simple CRUD app. These days that's a problem space so well defined you can practically specify the whole thing in command line flags. Rust really has little to add there. For other stuff, yeah Rust can be super cool.
Can you expand on this, please?
On a big project, you are going to be reading a lot more code than you are going to be writing.
As long as there is proper linting, both should be readable.
That being said, python is about the simplest language there is to read.
Of course if you have many times nested and improperly indented list comprehensions- sure that gets confusing. But that should be fixed with proper linting (black on its own should do it)
Curious about the examples you've seen that were difficult to parse!
foo = x if y else zMany languages support the ternary operator, where it would be:
foo = y ? x : z
Which "feels better" but I think that's because I learned ternaries first.Some languages like Rust and Kotlin do support assignment of an if statement like
foo = if (y) { x } else { z }
And I think that's a good step, as it doesn't need to introduce new syntax, just allows assignment of "blocks"In the beginning of doing Rust I was missing the ternary operator, but now I couldn't care less.
foo = if y { x } else { y }
Works well :-)Whenever I work on the Python service I feel like I'm working in clay. Like, everything kind of sort of works. It won't at first, but then you just poke at it with a stick until it does. In Rust, it works or you're told exactly why it doesn't and then you fix it.
I change a struct and the compiler provides me with a list of places that need updating.
I have many reasons (mypy, type system, testing, venv, python 2), but really the big one is rust's superior type system as well as general tooling (lsp is way better, cargo and clippy are phenomenal).
I just haven't found it to be the case that developers have a very hard time learning it, but we haven't grown to the point where that would maybe be the case. We also lean heavily into microservices so "oh there's no library in Rust but there's one in Python" is low cost, we can just write a service in Python.