- 0 Posts
- 3 Comments
Chais@sh.itjust.worksto
Programming@programming.dev•What's the point of Python if it's slow?
1·2 days agoAssuming this is a genuine question and not just trolling.
Python’s main feature, IMO, is that it’s easy to pick up. You don’t need to remember to put a semicolon after nearly every line, so you don’t need to remember which lines don’t need it. Basically you only need to remember to put a colon before an indented block.
Thanks to significant whitespace even bad code will be moderately legible.
Control flow and loops are basically written in plain English:for i in range(17):as opposed to e.g.for (int i=0; i<17; i++) {.
This all reduces the mental load and thus leaves you with more capacity to focus on the task you’re trying to solve.
It’s a great language to give to your mathematicians, data scientists and other people with rudimentary programming knowledge at best.As for the performance: interpreted languages are inherently slower than compiled ones. You don’t get a speed boost from first asking a separate program to translate the next line of code into a machine readable format before executing it. Just like you don’t get a speed boost from executing all your code in a virtual machine. Looking at you, Java.
But you don’t use python for the compute-heavy tasks. You use it for the plumbing in between and outsource the computation to a native library with python bindings, like NumPy, Pandas, PyTorch, etc. Horses for courses.

Those letters rang a bell, but I couldn’t place them. DuckDuckWent and it turns out they’re the first block of my Win7 registration key.