Python is eating the word.

When I type “Python” on the Library Genesis search prompt I’m getting some 300 pages (7628 files found | showing results from 1 to 25). This has to be bullshit.

Arguably, the mass hysteria has started when MIT switched from the classic MIT Scheme to Python as its main teaching language. The AIMA code at Berkeley has been ported from Common Lisp to Python at about the same time.

Then torch, which originally was a set of Lua bindings to some C++ libraries, has been rewritten to become a set of Python bindings to the same set of low-level libs.

Now it is “The Language of AI” (a meme), which is used to be Lisp.

And, of course, everyone and their moms know Python nowadays, and every single slop-book author is an expert in Python.

BTW, the tech publishing industry has been completely ruined by shitty blog-publishing sweatshops like Packt, BPB and what not. The golden age of Prentice Hall, and early O’Reilly Media is gone forever. Wait till it will be completely destroyed by an AI slop.

I am happy that I has been raised on the classic books, like “AIMA” and “On Lisp” and I watched the SICP (the Wizards) video lectures in a beach cabin somewhere in Sri Lanka. Plus the 2008 video lectures of prof. Brian Harvey – the classic CS61A.

Today the Berkeley CS61A course has been rewritten in Python. It became Composing Programs, which is almost on par with absolutely wonderful modern classic OCaml Programming: Correct + Efficient + Beautiful which is the SICP of this millennia.

Notice, that these “ancient traditions” can be easily traced back to LISP and ML respectively – the greatest classic languages (along with CLU).

So, is Python any good? Well, as a dynamically (but strongly) typed bytecode-interpreter it is a state-of-the-art with a lot of modern innovations (the optional “pluggable” typing is where the “bleeding edge” is). [Insert all the memes you know here].

Now lets get serious. Just as the Lisps used to be, It is a rapid prototyping language for an exploratory bottom-up programming as has been taught by PG. It is the language to which Peter Norvig moved to. It is the language which John Guttag used in his last book. It is the teaching language at MIT. All the best “things” the tradition has to offer seemingly “converged” (for good).

There are two of the most important points: Since its earlier days it has an attention to details and the strong emphasis on doing things just right,which only the best academic languages (OCaml, Haskell, Scala3) or literal works of art could ever have.

Thus Python3 is a principle-guided, carefully crafted and well-polished language, which is already more evolved than originally designed.

Second, there is an enormous, huge set of libraries for liteally anything, including the most boring and annoying CRUD and IO stuff. All the data-formats,all the protocols, literally everything is available.

This is what makes a rapid prototyping (and exploratory programming) even more rapid and lean.

On top of that, one could (finally!) decorate the critical parts of the code with type-annotations on the go, or at a first refactoring. This is a unique and grossly underappreciated aspect of the modern Python.

Nowadays you could even write a well-typed functional code with pattern-matching on proper algebraic types in Python 3.12+. It still slowly incorporates the best PLT research from the last 50 years of so.

There is a problem, however – a fucking shitton of absolutely crappy low-effort junk-food-like slop, both of code and of texts. Soon there will be even an AI generated slop.

There is no Royal Road to good programming.

We have been bullshitted out by the book publishing industry and the internet. They conditioned our minds that programming is about the programming languages (especially fucking Java and C++, and nowadays Python). This is very duffult to unlearn.

There are torrents of redundant, pretentious verbiage vomit on the sites like “Real Python” (why, yes, we understand – SEO, confusion for beginners – a solid business model) and in all these 300 pages of the low-effort crappy books rushed to print for a quick buck.

Programming, however, has this “structure”:

Domain expertice -> Matematical model -> Universal Strucures and related Algorighms -> Algebraic Data Types -> Shape of the functions and expressions ->  Abstract interfaces and proper ADTs -> Represenrations -> Implementation details.

The first 4 parts (and the notion of the shapes) are not optional, but absolutely necessary. This is precisely what makes Norvig so clever.

The media told you that your will be fine just knowing the language syntax. You wont. They can’t program themselves, so they write crappy “beginner’s” books.

One more time - 99% of the modern media is utter bullshit. Most of you haven’t even seen any better and do not know that such quality exists.

So where is the good code?

Norvig

Used to be one of the best programmers in the whole world (at NASA and Google). His code is an “optimal” (minimal) expression of related mathematical concepts in code.

This classic style is almost instinct nowadays, because it requires a lot of learning beforehand (Discrete mathematics, classic algorithms, functional “patterns”). Such kind of code could only be based on a proper understanding – it just naturally follows.

Soon we will have only an AI-generaged garbage instead.

CS61A

In the tradition of SICP, this text focuses on methods for abstraction, programming paradigms, and techniques for managing the complexity of large programs.

- Video lectures on YouTube

John V. Guttag

The former Barbara Liskov co-author and an MIT hotshot. There are some nice video lectures at MIT opencouseware.

Andrew Ng

He recast his classic lectures from Octave into Python. I am proud of passing his very first MOOC (86% score) back then, being taught in Octave.

His code is still very pragmatic and as clear as his math.

Karpathy

This is a sub-par Python code (compared to Norvig) but it is a very “real world” code.

This is also the best example of how the code “almost writes itself” when one have mastered the underlying concepts and related mathematics beforehand. This is the only “thing” I respect about him – he got this 10 years of practice.

In this (and only this) sense he is somehow like Norvig in the subfield of Deep Learning.

Warning: you have to easily tolerate a narcissistic personality distorder jumping at you. -Neural Networks: Zero to Hero

Now what?

Good programming is tremendously hard. It has many interrelated complex aspects, and neglecting just a single one will result in so-called “technical debt” (which is a polite name for stupid and ignorant early decisions) which is a very bad diagnosis.

The most fundamental and important parts are the abstract interfaces and the resulting modularity (penetrable cell membranes, just as in any way more complex but much more stable biological systems). Just as in biology, very few selected or “discovered” (by Evolution) stable intermediate (molecular) “building blocks” could be used.

The proper modularity and properly captured abstractions is the key to manage the inherent complexity of any problem domain. Everything else just “naturally” follows from this.

On the implementation side, it has to be layers upon layers of high-level embedded DSLs, just how mathematics itself has been structured.

The genius of Barbara Liskov was in the realization that not any imperative sequence of a low-level code will do, far from it!. Just a few “evolved, emergent” forms and universal notions (like of an environment and of a binding) underlay all of the programming (and math and logic), but this is another story.

So, Python got most the fundamental (and the most difficult) things just right. It has more than one library for literally everything. It is as good as the best academic languages (considering the decisions being made).

There are the best quality teaching resources (listed above) which will condition your mind properly, so you won’t have to unlearn socially constructed bullshit. One have to choice his or her “intellectual street food” very carefully, like I do.

Just do it.