But there are many languages in the world, and there are some that are as productive as Python, yet execute much faster.
But there are many languages in the world, and 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?
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.
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.
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 (notebook interface) and https://github.com/techascent/tech.ml.dataset (data frame library) will get you there
It is significantly faster than Python but has a similar vibe.
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.
zig and nim for tries to feel like a scripting language while still being fast.
Personally I like clojure for such things.
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/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...
"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.