$ python -c "import this"
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
It's to ensure the text is never altered because altering it would require reverse engineering the encryption algorithm which is a felony. (This is a joke, and a not-so-subtle criticism of the DMCA.)
I discovered this early on in my programming journey and it helped set my philosophical trajectory. Over the years I’ve slowly grokked these items. But it was valuable to have a North Star even before I realized why they were important.
Oh same, same. They didn’t all land at once but I remember multiple times I ran import this because I was bored or finished at the end of a day and thinking, “Oh yeah, I figured that out since the last time.” To me, it was a formative document and I can’t say enough good things about it.
Interestingly, today this text reads not only as good advice for coders but also as good instructions for agents. Perhaps time to revisit those and make sure the spirit of these adages is captured there
You've missed the joke, or maybe you weren't old enough to be learning Python during Java's heyday.
The joke is that people wanting to write Python like Java - with an implicit reference to an object's instance - would attempt to import Java's `this` keyword.
Instead of getting Java-like behavior, they're presented with the Zen of Python. You wouldn't be wrong to think that it was as much a commentary on other popular languages of the day as it was a guiding ethos of Python itself.
"Beautiful is better than ugly. Explicit is better than implicit."
Well that's embarrassing. I learned Java in 1996 in college. I was introduced to Python (1.5.2) at a startup in 2000. The startup was probably equally split between Java and Python code. I've essentially used Python almost exclusively since then. It's served me well in my career. I never have cared for Java.
Thank you for explaining the joke that's now old enough to drink, but somehow has eluded me all this time. :-)
I always assumed it was partly a reference to the famous McBainism from Star Trek: First Contacthttps://www.youtube.com/watch?v=qbZ-CfhuZ5s&t=88s which came out three years earlier in 1996. But also, the whole conceit of having a programming-language philosophy described in a series of aphorisms was itself clearly a gentle poke at Larry Wall and Perl, or at least a two-can-play gesture. It was Wall who was known for talking expansively about language philosophy.
Haha, yes! Back in the day whether self should be implicit or explicit was a major point of contention. Those who loved Java and C++ found self to be almost as repugnant as Python's indentation-based syntax. I even posted code on the now defunct ActiveState site to make self implicit again:
Seriously. None of those lines are actionable in any way. It seems to ruin afoul of its own advice, "If the implementation is hard to explain, it's a bad idea."
Some people (or maybe even most) take it almost religiously. Maybe because of the name.
But the Zen of Python is an absolutely great vision statement, that positioned the language very clearly in comparison to the ones that existed at the time, and was good enough to guide its development for more than a decade.
Still, yeah, you can negate half of those things and also arrive at a good language.
The only thing I never liked about this is complex is better than complicated. Every once in a while there is a post with an “insight” on how they’re different, but it’s the same word! Naming things is hard, but I wish Tim found another word for one of these.
A complication on a wristwatch is anything other than telling time. Phases of the moon? Tides? Calendars? Complications. They make the innards more complex and fragile and difficult to build and repair. Complexity is the inherent difficulty in building the thing.
Together, what that's saying is that sometimes the minimal baseline complexity is going to be pretty high. If you're making a library to support all of HTTP/2, it's going to have lots of codepaths, and that's unavoidable. It's a complex problem requiring a complex solution. But consider SMTP, the "simple" mail transfer protocol. The protocol itself is stupidly simple. I can use — and have used — telnet to port 25 to send email. But because the protocol is so simple, implementing it is extremely complicated. Were the protocol a little more complex, the implementations could be vastly simpler.
Or perhaps more simply, if you're writing a textual protocol, define it as using UTF-8 encoding and move on. UTF-8 is more complex than simpler encodings like ASCII. Allowing your clients and servers to decide that they'd rather support something goofy, like Shift JIS or UTF-16, just makes everything vastly more complicated. Accept that the complexity of UTF-8 is inherent and sufficient, pay the cost, and then let all of your consumers be much simpler.
Complex - many parts (but the parts could potentially be simple)
Complicated - have to understand many things in order to understand it at all; large surface area
The two words are both centuries old, so have had many chances for various authors and fields to adopt them for differing purposes, sometimes in contradictory ways. So for example a "complex system" (in the sense of the Santa Fe Institute) means something moderately different than what Tim Peters means. In plain English, they are broadly synonymous, so if you were writing a newspaper story you shouldn't expect readers to find subtle differences between them.
But if you know somewhat what implication a particular writer intends in drawing a distinction between the two words, then there's no inherent problem. "Simple is better than complex. Complex is better than complicated." is a pithy way to express a valuable idea:
We should try to make our interfaces, data structures, implementations, systems, etc. "simple", that is, dealing with just one thing at a time, in a clear and straightforward way, with few components each with a well defined purpose, etc. Sometimes, however, there is inherent difficulty in a problem or in the world requiring many interacting pieces, but we should still aim to avoid making things "complicated", that is, tangled, messy, difficult to reason about, ambiguous, unpredictable, gratuitously mixing unrelated concerns, etc.
A lot of words in English are etymologically related but have grown significant connotative or denotative differences since the root word was reintroduced to the language by another path.¹ "Complex" and "complicated" are just such a pair. They are not the same word.
In this case you can think of "complex" as referring to essential complexity and "complicated" as referring to incidental complexity.
----
1: See also, for example: "intention" vs. "intension", "chief" vs. "chef", "hotel" vs. "hostel", "corpse" vs. "corps", "compliment" vs. "complement", etc. Sometimes related pairs do the opposite, entering with distinct denotations and developing overlapping ones e.g., "intellect" vs. "intelligence". Some transitionsl ones still include overlap but have had specialized senses come to dominate, e.g., "dispositive" vs. "dispositional". In that last case, the special legal sense of "dispositive" came to dominate the word (or the other senses became archaic) in a way that "made room" for the more general "dispositional" to enter the language.)
If you wanna get your head around English (or probably any language), the intuition that alerts you to related words is a very useful sensitivity, but you have to learn to absolutely resist the temptation to treat etymologically related words as identical. It's just not how language works.
English seems like it might be especially rich with these "etymological doublets" (thanks ChatGPT, for teaching me this word today). They're really useful for capturing distinct shades of meaning between closely related concepts, which is exactly what they do in this adage from Tim Peters.
It's generally a tradition for wise adages to be a little ambiguous leaving interpretation to the reader. I think that's as much a feature as it's a bug. Perhaps he meant it that way.
I guess if you take the square root of -1 you do get a complicated number, but it's a complex one. And then there's the complication for modern democracy called the military-industrial complex, and Oedipus's complex certainly complicated things. Then there's Ghost in the Shell: Standalone Complex, but I'm not really sure what that means.
Seriously, here's the best summary I can quickly find: [0]
"Complicated problems can be hard to solve, but they are addressable with rules and recipes, like the algorithms that place ads on your Twitter feed. They also can be resolved with systems and processes, like the hierarchical structure that most companies use to command and control employees.
... Complex problems involve too many unknowns and too many interrelated factors to reduce to rules and processes. A technological disruption like blockchain is a complex problem. A competitor with an innovative business model — an Uber or an Airbnb — is a complex problem. There’s no algorithm that will tell you how to respond.
This could be dismissed as an exercise in semantics, except for one thing: When facing a problem, says Nason, managers tend to automatically default to complicated thinking. Instead, they should be “consciously managing complexity.”"
Those are very different problems for software development too, and many in IT definitely try to treat every problem as complicated.
Simple and complex are two sides of the same coin. Both are everywhere in nature. Complication is something else, but how can you describe it? I can think of examples. Bureaucracy comes to mind. Locking and synchronization primitives too. The kind of fragile mechanisms in the Linux kernel that lead to endless CVEs are another. All man-made things!
> There should be one-- and preferably only one --obvious way to do it.
Oh boy, that didn't age well for Python language did it? It matches with C++ in growing complexity of syntax features. With a couple dozen ways to write the very same algorithm.
To be honest I found this sentence to be beautiful and true for many years after working a lot with php and perl.
The mort important word in this sentence is obvious. There are many many many ways to do the same thing but working with python I found that mostly to be true, there is always an obvious, documented way (and not two of three!). Searching for a way to do something in perl, for example, was such a huge difference.
It is really more aspiration, and a good programmer mantra anywhere. Nothing here is so Python specific outside namespaces, and ... that is also a good programmer mantra.
Fourth reply to the article in the link, by Chris McDonough includes:
> "You have Tim to thank at least partially if you were a refugee from Java or Microsoft languages, which made excuses for their sprawling verbosity, complexity, and poor readability. Python, at the time, made none of those and had none of that (it now does). Tim was crucial in ensuring it stayed that way during his most active years. He will claim differently, but, by my observation, it is no accident that Python ballooned in complexity after his exit as day-to-day core developer."
Python has never followed the Zen. The irritating way the language lets you use non-booleans in a boolean context flies right in the face of "explicit is better than implicit".
This will probably sound crazy to some of you, but I believe the introduction of the boolean type was a mistake.
Every primitive type has a null value, and the "if" statement tests for such a value. Whether a value is true or false is a property of the value. Notice that "true" and "false" are adjectives, not nouns.
That is a simple, internally consistent model with one concept of trueness.
The introduction of the boolean type made this a lot messier: it makes "if" look like type coercion, and introduces two different ways to think of boolean-ness (as an adjective or as a noun) which you must hold in your head at the same time. For example, it became possible to compare things as equal to True or False, doubling the number of ways to express a condition: "if x" and "if x == True" are now very similar, but subtly different, ways to express the same thing. The fact that we have to talk about things as "truthy" or "falsy" as if these were different from "true" and "false" is a further illustration of the mess this has created.
If we had stuck with 0 and 1, we would have avoided all this confusion. It is imperfect but simple; what we ended up with is still imperfect and needlessly complicated.
> If we had stuck with 0 and 1, we would have avoided all this confusion.
I don't see how. Indeed, using 0 and 1, the int values, as if they were boolean false and true created more confusion. First, int has more values than just 0 and 1--and all of them are "truthy". Second, treating 0 and 1 as booleans is still treating boolean-ness as a noun--but also confusing that with treating it as an adjective for those int values.
PEP 285, which introduced the bool type, gives other rationales as well:
I still have a printed stack of Python 1.5.7 docs from when I first learned the language.
The addition of boolean `True` and `False` were a huge improvement to the language when they were finally added in 2.3.
I'm not sure why you're making things more complicated than they need to be. Test for truthiness. Conditional statements already evaluate boolean expressions, you're not adding anything explicit by writing `== True`.
Does it? "bank account has 0 dollars" and "no bank account" are different states. 0 cannot (should not) try to represent both. Same for empty string, empty list, empty set, they are data not nulls. Python has None for that.
But None has its own type; it's not a value of any of the other primitive types. Which makes sense if you use None to represent "no data present" vs. "data present, value is the null value".
Booleans are reductionist and likely harmful, as they allow programmers to avoid thinking in terms of the test they are actually performing: is this a member of some set? If the problem is reworked like that Booleans are superfluous (this representation could be compiled to something as performant as using Booleans).
I am not sure if that perspective aligns with yours.
Not sure why you're getting downvoted so much, but to put this thought into a somewhat broader context:
In an explicitly, statically typed language, bools might be useful as a standard small enum.
In what Python used to be, they weren't, not really.
But for whatever reason, declared typing is now an add-on to the language, and the people who like the verbosity of declared typing also, perhaps schizophrenically, like the terseness afforded by having a standard small enum.
That's because the Zen is a collection of fuzzy aphorisms about taste. Python has in fact never had a set of hard principles that constrain the design of the language.
In other traditions, type systems or the borrow checker or even vaguer things like a commitment to a "tiny core" of just a few primitives constrain language designers in a way that (sometimes inflexibly) commits them to the consequences of earlier design decisions. Python has mostly been designed one step at a time, by fiat. It's not a surprise that the result is an inconsistent language, especially after the resignation of the BDFL, and especially after so many years of widespread popularity.
> (Also, uh, if anyone has any ideas for projects I could do with a Pentium Pro in a few weeks once I no longer need it to host this chess engine ... do let me know!)
Throw a 3dfx Voodoo in there and do some real-time 3D Gaussian Splatting!
Run some current and still-compiled-for-i686 Linux or *BSD distros on it. See what breaks, save logs & report issues upstream.
A lot of support for old CPUs & platforms they're on goes through emulators like QEMU. Or plain old 'go with specs, disturb code as little as possible, and assume (hope) it still works'. But nothing beats running on actual hardware. Uncommon configurations, specific drivers that may have been broken (sometimes for a looong time before someone notices), spec says A but hardware does B, etc.
That reminds we, we had really weird results with splat-transform .sog output, when measuring the references for KISS-GS a couple months back. Why is the .sog curve dipping in quality when adding more primitives?
The issue you saw had been addressed in 1.7.0. We were generating codebooks for color and scale using k-means, which would result in bad values sometimes for the extremes. In 1.7.0 we switched to an optimal quantiser with outlier handling. It was actually surprisingly hard to get this right.
I just got opus to valid this now and it found another issue with our scale codebook gen, which I will fix now. Huzzzah!
Bit of a shameless plug: in August I built a demo [0] for our latest 3DGS compression paper (called KISS-GS). You can explore some standard Gaussian splatting scenes at different compression levels, see what breaks at really low bitrates, like 0.5 MB.
Scroll down the page a bit to unlock the controls under the viewer. I find the attribute toggles (for opacity, scale, rotation and so on) great fun for building an intuition on how splats and SOG compression works.
Drug discovery is a problem thats hard to define and measure. But we know that LLMs excel where there's clear metrics. Anthropic made a big point about speeding up Claude code and claude.ai with Opus 5.5, OpenAI is doing a sprint on Codex this month.
So dear AI labs, here's a drug-related challenge for you that might actually help: streamline the production of the top 100 generic drugs. Make them higher quality, lower variance and then race against each other to drive down the price to candy level. Show us how to build mini factories for cheap that we can build anywhere in the world.
At introduction, Terra was a good mid-tier model. Terra [high] was on the pareto frontier of DeepSWE's score over cost, if only ever so slightly.
When I had Sol orchestrate Luna and Terra as implementation agents, Sol was a lot happier with what Terra produced and would find far fewer issues than what was implemented by Luna.
But a few weeks after introduction, OpenAI slashed Luna's cost by 80% and Terra's only by 20%. Only then did it become uneconomical to run Terra and its reason to exist stopped.
There are cars with engines that will bring you to 250 mph without burning out, like the Bugatti Chiron. Unfortunately you will burn through your $40k set of tires after 15 minutes at that speed. But don’t fret, because your fuel tank will be empty after 9 minutes anyhow.
The plot doesn't appear to be in Amdahl territory yet. The single-threaded time in the plot looks to be around 39 seconds. A perfect division into 32 workers without overhead would make it 39 / 32 = 1.22 seconds. With the multi-threaded workload being reported as 1.5 seconds in the text, there's still only .3 seconds of overhead + serial instructions that can't be parallelized.
Every doubling of the number of workers halves the execution time cleanly in the plot, from 40 seconds to 20 seconds to 10 seconds. Eyeballing this for 32 over 16 workers is difficult, but it still seems close to halving the total time once again. So there's not a lot of Amdahl flattening, it's just the plain physics of looking at a inverse-proportional curve.
reply