1446 points · by ayhanfuat · 3w ago · 208 comments
$ 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!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!
It's incredible how every single thought you think it's yours was already had a bunch of times.
> There you go: 20 Pythonic Fec^H^H^HTheses on the nose, counting the one I'm
> leaving for Guido to fill in. If the answer to *any* Python design issue
> isn't obvious after reading those -- well, I just give up <wink>.
https://mail.python.org/pipermail/python-list/1999-June/0019...
(https://en.wikipedia.org/wiki/Zen_of_Python has more about the discrepancy.)
$ python -m this # -mthis works tooThe 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."
Thank you for explaining the joke that's now old enough to drink, but somehow has eluded me all this time. :-)
https://web.archive.org/web/20211128002836/https://code.acti...
For good reasons, Pythonistas were not appreciative! :)
No, that isn't where the name comes from; the slogan "import this" was chosen for Python in a contest, and the decision was made to stuff the Zen there because it was also importable code. There's no record of who submitted this slogan or what the motivation was. And I certainly never heard of anyone trying to get a `this` keyword by importing an ordinary module; that would make no sense (the closest reasonable spelling would be something like `from __future__ import this_keyword`).
https://discuss.python.org/t/in-memoriam-tim-peters-1952-202...
Pretty much all of this critique applies squarely to the Zen of Python.
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.
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.
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.
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.
> "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."
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.
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-...
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).
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.
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
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.
If something is complex, you have to deal with it. But to complicate things is to be avoided.
.
Thing is good.
But sometimes Thing is bad.
I dunno man, use your judgment.(EDIT: Robert Woodhead apparently shares in the credit, too: https://www.ceas.cc/papers-2004/136.pdf https://ceas.cc/papers-2004.html . Apparently Rob Hooft was another implementor? I can't find a good source for that though.)
The reason that's especially interesting is that I was using an AI to write something that needed that functionality, and it spewed out that same Python code, which I recognized immediately. It was slightly modified with respect to naming and comments because, I assume, it was stored slightly imperfectly in the model's weights.
This is what engineering is all about. Applying what it long known to solve new problems, or old problems better.
LLMs are a triumph today because someone made a keystone observation
I was an active participant in the comp.lang.python Usenet channel in the late 1990s.
I learned much from reading Tim Peters' posts. To many, including me, he was affectionately referred to as "Uncle Timmy."
One of the things I learned was that I still had much to learn about the art of programming.
Much of the little I know about numerical methods comes from reading his posts. It was fun to read his stories about Kendall Square Research and the (for me) old days of computing.
I remember posting questions about things I didn't understand, which he figured out and explained. [1]
I remember bringing up concepts I thought were specialized and esoteric, only to find that it was actually just my lack of experience. He gently corrected misapprehensions like mine. [2]
He wrote a lot on comp.lang.python. If I recall correctly, at the 7th International Python Conference in Houston, November 1998, there was Festschrift in his honor. He would use <wink> in his messages, and often end with something like "let's-hear-it-for-lambda-in-curly-assignment-stmts-ly y'rs - tim" (that's from the posting where he outlines the Zen of Python). I wondered if they were collected by looking for messages containing an '-ly' only to have Andrew Kuchling remind me about the "From" header. <wink>
Here is Guido van Rossum starting the thread on "In Memoriam: Tim Peters", at https://discuss.python.org/t/in-memoriam-tim-peters-1952-202... .
Here's an interview of him at PyCon 2006, https://www.youtube.com/watch?v=1wAOy88WxmY
[1] In one case, I was parsing a file format where a field was usually three spaces, but was sometimes an integer. I couldn't figure out why one parser was so much faster than the other. The answer was that one tested for three spaces first, and if that failed tested for the int, while the other did the int test first.
Yes, this is something a senior developer knows. I bring it up now to highlight how hotshot-me didn't have that experience, learned that experience, and learned it from someone who was kind about sharing his knowledge.
[2] I was doing bioinformatics back then, and learned about dynamic programming as way to do sequence alignment. I didn't think others knew about the technique, and thought I was bringing esoteric new information to the discussion. Uncle Timmy had used dynamic programming techniques for speech-to-text software at Dragon Systems, and politely pointed out it was more widely known. He also implemented Python's 'difflib'.
Another thing that made me feel close to him was his work on the Python Cookbook 2nd Edition, in which he (and other big names in the community) delightfully talks the reader through intricacies and insights of programming, "We read Knuth so you don't have to".
Watching Tim do his thing was a pleasure. He'd go from long, deep technical dives (that he'd make as approachable as possible) into comic relief and human connection in the fractional wink of an eye.
The brief interactions we had will always be cherished as high points in my Pythonista trajectory.
One favorite of mine was this response: https://www.python.org/doc/humor/#id15. I also like https://www.python.org/doc/humor/#id19 very much.
https://groups.google.com/g/comp.lang.python/c/DfzH5Nrt05E/m...
> if-tabs-were-called-hemorrhoids-as-god-intended-people-would-see-them-for-the-bloody-mess-they-are-ly y'rs - tim
He was always so willing to foster discussion that nearly every interaction resulted in an improved understanding of some topic and a shared eagerness to try or learn more out something tangential that came up via digression. I never knew how many types of voting systems there were nor how extensively they are researched! He also reached out about a comment [0] I made a few years ago which made me feel less discouraged and more welcome.
Tim's writing style was greatly appreciated by myself and many others. What he had to say was often lengthy, to address reader assumptions or some nuance, but was written with such a jovial tone that it was rarely dull or inaccessible.
RIP Tim
I like reading his answers. He always seemed to have something interesting to say, and his answers are kind, light-hearted, approachable and insightful.
At the time I didn't realize it was the Tim Peters. Very helpful guy. RIP
RIP, Tim.
For me, Tim Peters was that guy. I first met Tim in person at the first PyCon at GWU where I rode an elevator with him and Barry Warsaw. Let me tell you, it was a wild ride. He was a genuinely really nice, smart, kind guy.
RIP my friend.
You never know when an email is going to be the Last Email. Don't put off reconnecting with old friends.
And after that three months suspension BS drama Tim just got back to work on Python. Saintly.
btw. made me stop having a favourite programming language.
They can keep the tools & remix new ones with LLMs. The rest of us can hang out in some tiny corner talking civilly.
As someone formally trained in many forms of dispute resolution, I'll also offer many of these have a significantly misguided view of effective dispute resolution. They often think some neutral and objective group of people evaluating a situation is an effective way to resolve code of conduct disputes, in part out of a desire to be fair and objective. But these are social disputes and not contract or other legal disputes. Applying mechanisms meant for one to the other does not make a ton of sense
When we find ourselvees thinking that, then we are part of the status quo - the system is designed to suit us. It's very easy to think that status quo is the entire universe; just keep doing what you're doing. Instead, to avoid perpetuating the bad aspects of the system, it's essential to curiously and closely look for its boundaries, look outside it, notice the humans out there who are not being served, who may express unhappiness.
Take them at their word; they may seem absurd, but that's your human response to someone violating norms - the norms being the status quo. Their expression may include being disruptive or unpleasant. 'Disrupt' means 'violate the status quo'; it shows you the status quo's limitations.
Unless you are an insider to those discussions you’d not know what was said by whom
Implications that someone should interfere with a process publicly seems wrong as well
It looks like you (plural) bring it up only to push your political agenda against Woke or whatever.. while people are mourning and I find it frankly distasteful and an insult to his memory.
> While I've since adopted a tedious posting style to avoid triggering newer people, I haven't really changed. I'm not a grim person, and still find humor (sometimes dark) in almost everything. I just keep all sense of joy bottled up now. "Joy is not professional, supportive, welcoming, or inclusive - unless it's joy at the humiliation of perceived enemies of our new Mandatory Utopia" ;-) [..] > I would like an apology from the PSF, but don't expect one, and don't insist on one. What I demand is that they improve the broken _processes_ that led to this. My case wasn't the first one of trumped-up fantasy charges, and won't be the last
They are not woke in the first place. The "old white men" keep their corporate positions that they pretend belong to the underprivileged. David Mertz pointed that out and was swiftly disappeared by the Python Gestapo.
We are talking about a political system which seeks to introduce or apply rules that are obviously unfair on their face, justified by inconsistent theories that constantly make hypocrites of their proponents. It is bizarre and unreasonable to call opposition to this a "political agenda".
As one of the people directly involved in the situation, let me tell you: defending my friend's legacy is part of the mourning. His treatment was clearly unjust on its face and now the people who were responsible and/or supported it or advocated it are trying to blend in and pretend nothing happened, while showing no remorse whatsoever. While I'm sure the benedictions they offer now are sincere, I find it mind-boggling that it seemingly gives them no pause to consider what happened. Especially considering the timing (dying around the second anniversary of the original tension, and this being discovered around the time of his reinstatement).
Tim made an entire separate blog site to plead his case, largely motivated by my own posts[0][1]. His "mea culpa"[2] ceded only a tiny bit of ground, and even that was frankly unreasonable. (In the post[3] where he accepted blame, he was explicitly calling out an oppressive power structure, just apparently not the right one.) Not to mention that he was very clearly being "tone policed" by people acting on behalf of the very movement that popularized the term to try to shield themselves.
The insulting thing is to pretend that any reasonable person could ever have seen any merit in the claims against him after any honest inspection of the evidence (to the extent that evidence was presented: the nature of the claims made it clear what public events were being alluded to, while nothing private was ever asserted to exist).
[0]: https://zahlman.github.io/posts/an-open-letter-to-the-psf-co...
[1]: https://zahlman.github.io/posts/open-letter-psf-coc-wg-adden...
[2]: https://tim-one.github.io/psf/meaculpa
[3]: https://discuss.python.org/t/for-your-consideration-proposed...
This whole episode certainly reflects very badly on PSF SC. But it is not a very glorious event of Peters' life either, and it feels better to just not uselessly stir the pot in a way that makes Peters not look good.
(and again, to be clear, PSF SC looks even worse, but of course the point is to remember Peters for what he was, not to profit of his passing to score points against PSF SC)
Regardless of who was wrong or right, is it the way you would like to be eulogy written about you? bonoboTP was such a nice person and helped so many person and here is a myriad of example to prove how. All that said, I will remind everyone he had a fight a few years ago with some people he worked with and there were not very nice to him. It is just but a pebble in a long fruitful life, but it is really important I mention it here to remind everyone CoC = bad
It feels surreal to learn about his death just the next day. RIP
"[Tim] took up Python on a lark in its very early days, becoming something like Python’s second real user after Guido.
Guido came to rely on Tim heavily. Tim will demur about this, but as far as I can tell, Tim and Guido were largely partners in the design evolution of very early Python, and before most important features made it in to Python, you could be sure that they had been examined from every angle, shaken, stirred, and thunk about very hard by both of them.
Tim often played the role of gatekeeper and polisher. 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.
[...]
Tim was a Director of the Python Software Foundation from 2001 to 2014, bringing Python across an uncanny valley from a time where it was “interesting but ignorable” to “the planet’s default language” along with a cast of other incredible people. If you use Python, it’s not in small part due to Tim."
"Question everything. Love everyone" (from his page)
RIP "Uncle Timmy".
The language was named after the British comedy troupe rather than the snake.
1: https://mail.python.org/pipermail/python-list/2000-March/048...
(I've taught the Zen of Python, doctests, timsort, and more during my career.)
https://commons.wikimedia.org/wiki/Commons:Email_templates#E...
Never really ended up using Python outside one-off scripts and personal stuff but learning the magick of making silicon do work for you and principles for that really stuck with me as I went to high school and beyond.
RIP :'(
He'll be sorely missed by everyone who has read the Zen of Python (but not limited to it ofc).
Your corporate sinecure "custom Python distributions" are secure now!
Thinking that the Python software foundation decided to ban this person for frivolous reasons is both laughable and sad.
https://lunduke.locals.com/post/5985667/python-bans-prominen...
One could infer that the core of the issue is that Tim started to ask questions about why the board would grant itself additional powers (see bylaws), advocating for transparency and accountability. They were not happy about that and locked the discussion.
Then they started to look around for reasons to tint his reputation and ban him.
Look at this open discussion/question (https://discuss.python.org/t/how-can-we-better-support-neuro...) from Tim to know whether neurodivergent people were accepted by the Python community, and how they framed it as:
"Dismissing unacceptable behavior of others as a “neurodivergent” trait, which is problematic because it creates a stereotype that neurodivergent people are hard to interact with and need special treatment."
Which was one of the reasons of the ban.
They even considered the use of the wink emoji to be harmful, apparently.
https://chrismcdonough.substack.com/p/the-shameful-defenestr...
I'm not saying a reasonable person looking in from the outside couldn't think they were frivolous. I'm just saying the PSF leadership themselves didn't think they were.
I personally, looking in from the outside, wouldn't necessarily describe the reasons as "frivolous", but I think "unjustified" certainly fits the bill.
I agree.
It's not even much of an inference. The discussion went sideways because Steering Council members in the thread kept responding to Tim's questions about why the proposed bylaws change was being made (and pushed through very quickly with no real discussion) by saying "there are reasons, but they're secret and we can't talk about them, trust us", and getting very hot and bothered when that answer was not accepted (and not just by Tim, there were multiple people in the thread who were not satisfied with it and explained why at some length).
After quite a bit of back and forth, one SC member (I think Thomas Wouters but I'm not sure) admitted that there were specific PSF Fellows (giving no names) who the Board planned to use this new power to remove. And it's at this point that Tim's ban becomes even more of a footgun on the PSF's part, because when Tim saw this, he said that knowing it made him more likely to vote for the proposed bylaw change, since apparently the need for it was not just hypothetical. (Others in the thread took a much more negative view of the revelation than Tim did.) So the whole discussion that Tim prompted ended up with Tim supporting what the PSF were doing in this case--which should have been a cue for the PSF to say, hey, good, I'm glad we've addressed your concern and you're ok with this now. But instead--they banned him.
Condolences.
The first thing I was taught by my first boss was import this.
Lived most of my life since by those principles where practically applicable.
It's sad to hear, but reflecting on the impact Tim made brings some comfort. Most of us will never know how many people our work helped. Tim could at least see some of that, though even Python's reach can only tell part of the story.
Reading the tributes (https://discuss.python.org/t/in-memoriam-tim-peters-1952-202...), what strikes me is how often people mention his patience and humour alongside his technical brilliance. There's something to aspire to there: doing good work, and taking the time to help others do theirs.
The older I get, the more I appreciate what it takes to leave both kinds of legacy.
Quiet lines of code Still guide the hands of strangers His kindness lives on
Rest well, Tim.
There are a handful of names in the tech industry who will hit me particularly hard and among those one who will really make me pause.
They will leave behind work that continues to impact the world but given the choice I'd still have them in it.
In my case none of the work I leave behind is going to mean a real lot outside of the people who paid me for that and I'm old enough that the majority of what I've written over the years is now no longer having any impact (refactored or replaced after years) though I'm aware of one that is still actively supported now that is 17 years old.
Almost everything all of us do in terms of actual work output is transient but we do leave memories, I have a mental list of programmers I've worked with over the years who left a last impact and while none of them afaik had the impact of Tim Peters broadly they did narrowly for me at least.
Some are gently deallocated. Others are garbage-collected.
I focus on how I learned to be a better software developer from him, in both writing better code and supporting others.
I was actually careful about wording because while my impression is the same as yours I thought it would anger people if I said so. I was expecting to be down voted by people defending his suspension.
''' Our current board has a majority of people from the Global South or otherwise marginalized groups. That is encouraging and an extremely positive thing. As long as people who are demographically similar to me do not again have a majority, I have the utmost faith in the Board.
As far as I’ve seen, the entire support of this amendment comes from people who look and speak a whole lot like me. People like me should not be trusted. '''
I think that such people have embarrassed themselves sufficiently over the past few years, and that Tim would not have wanted us to use his obituary to embarrass them further. I say this as a person whose family comes from the Northern hemisphere portion of the Global South.
What I do not understand is why people are interpreting what I say as supporting those people. I was very careful to just state facts to avoid taking a stance without full knowledge. Is that somehow not acceptable?
> I say this as a person whose family comes from the Northern hemisphere portion of the Global South.
As am I, at least in where I was born and my nationality at birth. I regard "Global South" as horrible, patronising term - although not as bad as "Global Majority" which is worse, if not downright racist IMO.
[0]: https://discuss.python.org/t/for-your-consideration-proposed...
[1]: https://discuss.python.org/t/why-i-am-withdrawing-fellowship...