upvote
Which is stored in `this.s` as the following string:

Gur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpgvpnyvgl orngf chevgl. Reebef fubhyq arire cnff fvyragyl. Hayrff rkcyvpvgyl fvyraprq. Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu. Abj vf orggre guna arire. Nygubhtu arire vf bsgra orggre guna evtug abj. Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn. Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!

reply
Oh, ROT13!
reply
...but why? Why is it encrypted and not stored as plaintext?
reply
Wouldn’t be much of an easter egg if it was too easy to understand <wink>?
reply
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.
reply
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.
reply
> Oh yeah, I figured that out since the last time.

It's incredible how every single thought you think it's yours was already had a bunch of times.

reply
The PEP explicitly says there are 20 of which only 19 are written down and I can't figure out if that is a joke, a deliberate statement, or both.
reply
And at that moment, shiandow was enlightened. ;)

(https://en.wikipedia.org/wiki/Zen_of_Python has more about the discrepancy.)

reply
Two of the most common bugs in programming is the off-by-one error.
reply
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
reply
I have cited this poem countless times over the years--sometimes ironically. I'm sad.
reply
More succinctly, you can run this as a module:

  $ python -m this  # -mthis works too
reply
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."

reply
c.f. what happens when you try `from __future__ import braces`
reply
The call to import this has more than the Python syntax meaning.
reply
This is a lot of wisdom, which you can tell comes from years of experience. I would like all llms of the world to have this as their base prompt.
reply
https://www.youtube.com/watch?v=anyhBdt79Cs

Pretty much all of this critique applies squarely to the Zen of Python.

reply
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."
reply
For some reason, this describes Rust to me way better than it describes Python.
reply
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.
reply
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.

reply
See also, Constraints Liberate and Liberties Constrain
reply
Complex = a problem that's inherently difficult to solve due to its fundamental nature. Time is a great example.

Complicated = a solution that's difficult to understand due to a convoluted implementation. These can be simplified.

In other words, the difference is whether the difficulty is inherent to the problem space (complex) versus inflicted by a solution (complicated).

reply
If complex only refers to inherent complexity (and not accidental complexity and whatever other attributes were used by people before) then how is "simple is better than complex" to be read? If complex is inherent to the problem, does it mean "solve a different problem"?
reply
I'll take a stab in this context:

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

reply
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.
reply
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.

reply
to complicate = to make more complex

If something is complex, you have to deal with it. But to complicate things is to be avoided.

reply
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!
reply
> it’s the same word!

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.

[0] https://sloanreview.mit.edu/article/the-critical-difference-...

reply
> 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.

reply
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.
reply
Let's start off with 'Which Python?'
reply
There will always be a billion way to write the same algorithm in a Turing-complete language. That is not the point.
reply
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.
reply
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".
reply
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.

reply
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`.

reply
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.

reply
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.

reply
And typing wasn't explicit for a long time. Now it is kind of best practice, but you can still produce Python without typecheck metadata.
reply
Practicality beats purity!
reply
Except it mostly just leads to suprising bugs and time wasting, in exchange for saving a small amount of typing
reply
Do you know why it is the way it is?
reply
I took this mantra with me when I learned other languages.
reply
Hard to disagree with any of this. RIP.
reply
It's hard to disagree, since it's very vague and subjective.
reply
Thank you, Tim Peters.

.

reply
[dead]
reply