5 ms·
Article compares Rust to Python claiming that whilst Python is indeed slower, it is more productive for developers. But there are many languages in the world,
by greener_grass 2y ago
Article compares Rust to Python claiming that whilst Python is indeed slower, it is more productive for developers.
But there are many languages in the world, and there are some that are as productive as Python, yet execute much faster.
- amelius 2y agoIf you look at productivity you should also consider size of the ecosystem of libraries.
- dkga 2y agoThis. I love Rust and I also love python, although for different reasons. But in python you can always find that one library or codebase that you need or that will inspire you to get there. In Rust it still sometimes happens that when you go off-road, you may be on your own for some functionalities.
- blenderob 2y ago> there are some that are as productive as Python, yet execute much faster I'd like some recommendations for this from the community. As productive as Python but faster execution is the kind of sweet spot I want to explore and learn. Any specific examples or recommendations for such programming languages?
- krona 2y agoLua? That being said, performance isn't really an aspect of the language but of the compiler and runtime. PyPy for example, has a Jit compiler.
- jsheard 2y agoIt depends on what you're doing, but for web stuff Go is the popular middle-ground choice that's not quite as fast as Rust but is much faster than Python or Ruby. Go is garbage collected, unlike Rust, so you get the productivity benefits of not having to think too hard about memory management.
- mhh__ 2y agoUltimately it depends on the task but I'm more way more productive writing D than python (assuming it's not just gluing libraries together in which case python obviously wins) because of the metaprogramming and that the basics are done well enough that I can actually trust the results without constantly staring at stdout second guesssing the semantics. Python isn't a particularly good force multiplier purely as a language these days. It was very wise to not go full OOP, so we are spared from the truly horrible, but python is basically C with lists and new syntax as most people use it.
- empath75 2y agoFor data engineering -- R and Julia.
- JodieBenitez 2y agoIf you can stand some archaism, Go is this language for the web stuff. It has nice things too, like efficient concurrency and easy deployment.
- jinwoo68 2y agoOCaml? It has an advanced type system but you almost never have to annotate types in your code. So it feels like writing in a dynamic language, like Python.
- rpcope1 2y agoScala, once you get a feel for it.
- bobnamob 2y agoClojure (either native JVM or Babashka) Once you've got a repl up and running the JVM launch time isn't an issue and repl driven development lends itself well to data munging/exploration Clojure's data centricity (functional, everything's a sequence, strong data manipulation std lib) really makes it a dream for these quick and dirty data transformation/exploration jobs If you want to get fancy, https://github.com/nextjournal/clerk https://github.com/nextjournal/clerk (notebook interface) and https://github.com/techascent/tech.ml.dataset https://github.com/techascent/tech.ml.dataset (data frame library) will get you there
- greener_grass 2y agoIf you like functools, itertools and list comprehensions, you will probably like F#. It is significantly faster than Python but has a similar vibe.
- samatman 2y agoJulia 100%. Multiple dispatch and a proper macro system are a superpower. It also doesn't abstract over data in the same way: if you want a byte, you can have a UInt8. But it does abstract over data: a function can take a Number, and that is a very expressive supertype in Julia. The type system uses a lattice, which can be a bit unfamiliar, but once you get it under your belt, it's the jam. I highly recommend getting to know it.
- nicoburns 2y agoJavaScript is the obvious pick with those criteria.
- stonemetal12 2y agoJulia's whole thing is python but not slow. Crystal is the same but for Ruby. zig and nim for tries to feel like a scripting language while still being fast. Personally I like clojure for such things.
- archargelod 2y agoNim [0] IMO has syntax that's better than Python, while having a performance of C. See "Nim for Python Programmers" [1] for detailed comparison. Small example of Nim code (from relevant article [2]): var gc = 0 var total = 0 for line in lines("orthocoronavirinae.fasta"): if line[0] == '>': # ignore comment lines continue for letter in line: if letter == 'C' or letter == 'G': gc += 1 total += 1 echo(gc / total) [0] - https://nim-lang.org [1] - https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers [2] - https://benjamindlee.com/posts/2021/why-i-use-nim-instead-of-python-for-data-processing/
- winddude 2y agoThere's also something about python, that it was/is extremely fast to learn and pick up.
- empath75 2y agopython is basically "if pseudocode was a language".
- greener_grass 2y agoNew programmers don't know pseudo-code either; I'm not sure why being like pseudo-code would make it easier to learn. I think Python is easier to learn than many languages - definitely its competitors at the time Perl and C++ - but I don't see why it is any easier than BASIC, Java, Clojure, Scheme, F#, JavaScript...
- globular-toast 2y agoAgreed, I wouldn't say Python is particularly easy to learn. "Easy to learn" is difficult to define anyway. Is chess easy to learn? Any child can learn the rules of chess in a few minutes, but it doesn't make them good at chess. Assembly is like the rules of chess (assuming RISC at least). Super simple, but you still need to learn how to do anything useful with it. The Python book on my shelf is about 4 times as thick as K&R. So by that (admittedly rather silly) metric, Python is significantly harder to learn. One might say Python being more expressive makes it easier, but nothing is more expressive than languages like Perl and awk yet they aren't considered "easy". We could also consider the principle of least astonishment. Python has some surprises: semantic whitespace being the obvious onev and others like a trailing comma creating a tuple. It used to C type languages were "hard" due to what happens if you miss a semicolon etc, but modern IDEs have pretty much made it irrelevant. Python's surprises are still there. So yeah I think Python sits somewhere with Scheme as being easy enough to get to the point of being able to do useful computing. But there's still tons to learn that any programmer has to learn regardless of language.
- winddude 2y ago
- LegionMammal978 2y agoFWIW, you can also make Python execute much faster than Python in many cases, by using PyPy instead of CPython. I've had great success using it to optimize my naively-written scripts. (But in cases where that's still not enough, I'll usually switch to Rust or another AOT-compiled language instead of contorting the script into unreadability.)