
Why the Slowest Language Won AI
This short audio course explains why Python dominates AI development across three connected lectures. The first lecture covers Python's core advantages: readability that lets data scientists and engineers prototype quickly without fighting syntax, a mature ecosystem of libraries including NumPy for numerical computing, pandas for data manipulation, scikit-learn for classic machine learning, and TensorFlow and PyTorch for deep learning, plus strong community support and Python's role as a glue language that connects high-performance components written in C, C++, or CUDA. The second lecture grounds these ideas in a hands-on project: building an image-classification model on a Raspberry Pi. Listeners follow the full pipeline in a single language, from hardware setup and data capture with the picamera library, through data handling in pandas and NumPy, preprocessing with scikit-learn, training a small convolutional network with PyTorch on the Pi's ARM processor, to serving the model through a Flask endpoint. The third lecture tackles the apparent contradiction between Python's interpreted, relatively slow nature and deep learning's massive compute demands. It traces how the community resolved this tension: TensorFlow's C++ core behind a Python API, PyTorch's dynamic computation graphs compiled to CUDA kernels, and tools like Numba, Cython, and torchscript that turn Python functions into native machine code. The result is a clear picture of a language whose simplicity accelerates research while compiled back-ends deliver raw performance.
Why Python Became the AI Playground
Why Python Became the AI Playground
Speaker 1
Okay, so this morning my phone suggested a route around traffic, then recommended a playlist. All before breakfast. And I keep hearing one word behind all of it — Python.
Speaker 2
Right, that ordinary moment is exactly where it lives. Python is quietly doing that work, and the strange part is it wasn't designed for any of it.
Speaker 1
Wait, it wasn't? I assumed AI people picked it on purpose.
Speaker 2
Nope. Guido van Rossum created it at the Netherlands' Centrum Wiskunde & Informatica, as a successor to a language called ABC. Development started in the late 1980s, and the first listed release, version 0.9.0, dates to 1991.
Speaker 1
Ninety-one. So it's older than the web, basically.
Speaker 2
Practically. And it's a general-purpose language — not built for AI or scientific computing at all.
Speaker 1
Then how did it, of all things, end up running machine learning?
Speaker 2
That's the story I want to tell. It starts with a limitation. Python's general-purpose origins meant it initially lacked dedicated support for scientific data structures and algorithms.
Speaker 1
So the language was easy to read but, what, empty-handed for math?
Speaker 2
That's a fair shorthand. And the fix came from the community. In 1995, an MIT graduate student named Jim Hugunin started a mailing list — the Python Matrix Special Interest Group — to discuss numerical operations.
Speaker 1
A mailing list. That's, that's the seed of the whole thing?
Speaker 2
It really is. Hugunin's proposal emphasized a common array or matrix object, so numerical libraries could interoperate. And the discussions included Jim Fulton, Paul Dubois, Konrad Hinsen — and Guido van Rossum himself.
Speaker 1
The language's creator was in the room.
Speaker 2
In the conversation, yes. That tells you something about how open this process was.
Speaker 1
Okay, so how do we get from a mailing list to the libraries everyone names today?
Speaker 2
In layers. NumPy supplies array data structures and numerical routines. SciPy builds on NumPy and provides scientific-computing algorithms. And SciPy is a foundation for higher-level libraries, including scikit-learn and scikit-image.
Speaker 1
So it's, like when you stack floors in a building — arrays at the bottom, machine learning on top?
Speaker 2
That's the picture. That layered ecosystem — from numerical arrays up to machine-learning libraries — is what makes Python useful for AI work.
Speaker 1
But who built these floors? Was this a big company project?
Speaker 2
That's my favorite part. SciPy's authors recount the project began in 2001 with little funding, written mainly by graduate students — many without computer-science training.
Speaker 1
Grad students without CS training. That's, that's honestly encouraging.
Speaker 2
It is. And Travis Oliphant combined elements of two earlier array libraries — Numeric and NumArray — in 2005. NumPy 1.0 followed in October 2006.
Speaker 1
Hold on — but is Python actually fast enough for the heavy math? Doesn't AI need serious number-crunching?
Speaker 2
No. I mean, no, it isn't fast by itself — and that's the twist. Python serves as the accessible interface, while the libraries provide the specialized algorithms and data structures underneath.
Speaker 1
So it's the friendly front door to the fast machinery.
Speaker 2
Exactly. The libraries let users reach specialized tools without implementing every algorithm themselves. Python is the glue.
Speaker 1
And the community kept compounding, right?
Speaker 2
It did. Python is open source, and the Python Software Foundation was formed in 2001 to own Python-related intellectual property. Contributions come from a broad community.
Speaker 1
Do we have a sense of the scale?
Speaker 2
SciPy's authors report more than 600 unique code contributors. Its 2020 Nature Methods paper counted thousands of dependent packages, more than 100,000 dependent repositories, and millions of downloads per year.
Speaker 1
A hundred thousand repos. That's a, that's a small city of dependencies.
Speaker 2
It is. And that's the virtuous cycle — more users, more contributors, better libraries, more users.
Speaker 1
Which brings me to the number I actually wanted to check. Is there hard evidence Python dominates today?
Speaker 2
There is. In 2025, 57.9 percent of respondents to Stack Overflow's Developer Survey reported using Python. That's a seven-point rise over their 2024 survey.
Speaker 1
Slow down — how many people are we talking about?
Speaker 2
More than 49,000 responses, from 177 countries. And the survey describes Python as a go-to language for AI, data science, and back-end development.
Speaker 1
So it's not just AI people — it spread everywhere and AI rode that wave.
Speaker 2
That's a fair reading. The readability lowered the barrier for researchers and data scientists compared to something like C++ or Java, and the ecosystem did the rest.
Speaker 1
Hmm, but I'd push back a little — readable syntax alone doesn't explain a, a dominance like this. Plenty of languages are clean.
Speaker 2
Agreed, and I wouldn't claim syntax alone did it. It's syntax plus libraries plus community, each reinforcing the others. Take away any one and the story weakens.
Speaker 1
Okay, that I'll buy. So for someone new to AI, where does that leave them?
Speaker 2
Invest where the ecosystem already lives. The tools, the tutorials, the contributors — they're all concentrated in one place, and that concentration is the point.
Speaker 1
Which, honestly, is kind of beautiful — a language nobody built for AI became its playground.
Speaker 2
And it started with a graduate student's mailing list in 1995. That's the part I'd write down.
From a Raspberry Pi to a Real‑World AI Model
Speaker 1
So I'm holding this little green board a friend lent me. A Raspberry Pi 5. And they claim it runs actual AI.
Speaker 2
It can, and there's a real study behind that claim, not just hobbyist forums. Brian Rodriguez, Nuri Yilmazer, and Joon-Yeoul Oh published work in 2025 doing exactly that on a Pi 5.
Speaker 1
Hold on — who are these people? I'm not accepting
Speaker 2
Researchers, and their paper describes implementing neural networks for handwritten-digit recognition on the Pi. I wasn't going to let that slide unnamed either.
Speaker 1
Okay, digits. So the board watches a camera and names the number it sees?
Speaker 2
That's the shape of it. A real AI application is a pipeline: capture input, prepare it in the format the model expects, run inference, and turn the output into an action or display.
Speaker 1
Inference — say that one in plain words?
Speaker 2
Inference means using a trained model to produce predictions. It's distinct from training, which is the expensive learning step.
Speaker 1
So the camera captures the image, then what, the board just... reads it?
Speaker 2
Not directly. The image has to be standardized. The Picamera2 library gives Python its interface to the camera, and the data gets converted to RGB — the format TensorFlow Lite and OpenCV expect.
Speaker 1
Wait — so all of that, the camera and the conversion, is also Python?
Speaker 2
Yes. And the arrays holding the image data are handled with NumPy, a common tool for scientific computing.
Speaker 1
Huh.
Speaker 2
And it keeps going. A classifier learns from labeled examples — for digits, the categories are the possible digit labels. Scikit-learn uses this exact task as its tutorial example of classification.
Speaker 1
So the model learns, then predicts. How does that actually work in code?
Speaker 2
you fit the model on training data with labels, then call predict on new data. Two calls, basically. Learning, then applying.
Speaker 1
But training on this tiny board — can it really handle that? I mean, it's a, a …
Speaker 2
Indeed. It can't comfortably, and that's why the study trains models separately, then deploys them to the board for live inference only.
Speaker 1
So the heavy lifting happens elsewhere, and the Pi just runs the finished model.
Speaker 2
Exactly. They ran TensorFlow Lite Runtime on the Pi for that live inference, with results shown in the console or overlaid on the image. TensorFlow Lite exists precisely for mobile, embedded, and IoT devices — its docs include an embedded-Linux path covering the Pi.
Speaker 1
They even 3D-printed a camera holder for it. That's, that's delightfully handmade.
Speaker 2
It is! A custom 3D-printed holder, a camera module, and the board. That's the whole rig.
Speaker 1
Okay, but here's my real objection. You could do all this in other languages too. Why does the Pi case prove anything about Python?
Speaker 2
Grant the strongest version — yes, other languages can run models. But they'd need separate toolchains: one for the camera, one for the math, one for serving. Here, Picamera2, NumPy, scikit-learn, and the model runtime all speak Python.
Speaker 1
So the count of languages across the whole pipeline is... one?
Speaker 2
One, from data collection to deployment. That count is the significance. Nobody wrote low-level C to connect the pieces.
Speaker 1
Hmm. But what about the hardware side — doesn't the ARM processor constrain—
Speaker 2
It does. The Pi 5 uses a quad-core 64-bit Arm Cortex-A76 at 2.4 GHz — no big GPU. So lightweight runtimes and quantization matter.
Speaker 1
Quantization, meaning...?
Speaker 2
Shrinking the model — quantization and compression adapt it to fit the resources on the device. The AI Camera docs require those steps before deployment.
Speaker 1
Wait, AI Camera? That's a different thing from the Pi itself?
Speaker 2
Yes, and it's the surprising part. The AI Camera's Sony IMX500 sensor has a neural-network accelerator on the module itself. The camera does the processing and returns results alongside the image data.
Speaker 1
The camera thinks.
Speaker 2
On the sensor. It even includes an RP2040 microcontroller and 16 megabytes of flash to cache recently used models. And it connects to every Pi model, including the Zero, via the standard ribbon cable.
Speaker 1
So what can someone actually run on day one?
Speaker 2
Ready-made examples. MobileNet SSD detects objects with bounding boxes and confidence values. PoseNet does pose estimation. Both ship with getting-started instructions.
Speaker 1
And — say the pipeline finishes — how does the model become a service something else can use?
Speaker 2
You could expose the trained model via a simple web service. It exposes the trained model at an endpoint, and other devices interact with it over the network. Same language, again, all the way out.
Speaker 1
a hobbyist board proves convenience, not production power. Training still happened off-board.
Speaker 2
Fair — and the strongest version of that objection stands. The Pi case doesn't prove Python is fast. It proves the ecosystem makes the full hardware-to-deployment loop reachable by one person in one language.
Speaker 1
One language, board to server. And that's the choice I defend — because the objection about speed was not the bottleneck. The bottleneck was glue, and glue is what Python is.
Speaker 2
And that rig started as a 3D-printed holder and a mailing-list language nobody designed for this. That's the whole argument, sitting on a desk.
The Speed Paradox: Python’s Simplicity vs AI’s Hunger for Compute
Speaker 1
I keep running into two claims that can't both be true. Python is too slow for real work — and Python is what real AI work uses. Every day.
Speaker 2
And they're both correct. That's the paradox worth sitting in before we resolve it.
Speaker 1
How? A language can't be slow and fast at the—
Speaker 2
Right, and the resolution is that the language you write and the machinery that computes are different things.
Speaker 1
So when I write a model in Python, who's actually doing the math?
Speaker 2
PyTorch's own docs say its Python frontend calls into C++ for the expensive operations, especially numeric ones. TensorFlow is similar — its Python API is the most complete, and its runtime runs the graphs.
Speaker 1
So Python is the, the steering wheel.
Speaker 2
That's the picture. NumPy was an early example. Its operations run in compiled code, not Python-level loops. A 2020 Nature paper described it as combining Python's readability with the performance of C.
Speaker 1
Give me a concrete case — what does that mean for a person coding?
Speaker 2
Think of adding a million numbers. In pure Python, you'd write a loop, and the interpreter walks every step. With NumPy, one vectorized line — the precompiled code does the walking.
Speaker 1
Okay, but someone had to realize this split was possible. Who was puzzled?
Speaker 2
Early researchers training neural networks asked whether an interpreter could ever keep up. The wrong turn was writing every experiment in C++ and losing days to plumbing. The click was separation: prototype in Python, compute in compiled libraries.
Speaker 1
And the stakes got absurd, right? I read something about compute doubling.
Speaker 2
A 2018 OpenAI analysis estimated compute in the largest training runs had been doubling about every 3.4 months since 2012. That's the hunger side of the paradox.
Speaker 1
Every 3.4 months. What does that even look like for one researcher?
Speaker 2
Picture a grad student whose model trained overnight last year — same idea now needs a lab's worth of hardware. That's why Emma Strubell, Ananya Ganesh, and Andrew McCallum's 2019 paper measured training's financial and environmental costs and told researchers to prioritize efficient hardware and algorithms.
Speaker 1
But wait — if the GPU does the heavy lifting, does every operation land on it?
Speaker 2
No — TensorFlow's GPU guide is honest here. An operation without a GPU implementation falls back to the CPU. And distribution strategies can replicate computation across multiple GPUs, splitting the data among them.
Speaker 1
So what would you actually wager on? That nobody needs C++ anymore?
Speaker 2
No. The odds might be about three to one that many researchers rarely use C++ — but PyTorch’s C++ frontend exists for low‑latency, multithreaded settings where the interpreter can’t go. Different use cases, not a replacement.
Speaker 1
There's also that threading thing — the GIL?
Speaker 2
In standard CPython, a thread must hold the Global Interpreter Lock to touch Python objects. Free‑threaded builds arrived experimentally in Python 3.13 — and even those don't automatically speed everything up; there's overhead.
Speaker 1
Hmm, so it's not a magic—
Speaker 2
It isn't. The compile side is more interesting. torch.compile captures the computation graph and generates machine code through a backend.
Speaker 1
Does it work? Numbers?
Speaker 2
One PyTorch blog benchmark — NumPy code, their particular case — reported a 9× speed‑up on one core, 57× on 32 cores. That benchmark, not a promise.
Speaker 1
Nine times on one core. Fifty‑seven on thirty‑two.
Speaker 2
NumPy's simple memory model lets people write hand‑optimized C or Fortran code and pass arrays back to Python.
Speaker 1
So the slow language wins because experiments turn around faster — write, run, rewrite — even if each step isn't raw‑speed champion.
Speaker 2
That's the resolution we opened with. Both claims were true all along.
Speaker 1
So what evidence would change my mind?
Speaker 2
Go find it yourself — the PyTorch compiler docs, the free‑threading how‑to, that OpenAI analysis. If a workload exists where the interpreter itself, not the libraries, is the bottleneck at scale — that's the number I'd want to see.
