The Zen Of Python Is A Joke And Here Is Why (You Should Not Take It Too Seriously)
Tags: zen, python, joke
Published: 2019-02-18 19:39:38

---
title: The Zen Of Python Is A Joke And Here Is Why (You Should Not Take It Too Seriously)
published: true
description: the zen of python needs more meditation
tags: zen, python, joke
cover_image: https://images.unsplash.com/photo-1464122632645-bf5f12bbe202?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1052&q=80
---

The Zen of Python inspires programmers all over the world, but, it is not to be taken too literally.

## The Venerable Zen, A Presentation

typing this

```python
import this
```
gives us

```
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!
```
that is called the Zen of python

## The One Line That Is A Hilariously Good Joke

let us take a look at the following line.
```
There should be one-- and preferably only one --obvious way to do it.
```
most developers understand it to mean that python makes you write your code in one way, instead of having many ways to express it. many then go on to contrast the linguist-invented perl with the mathematician-invented python.

however, there are two catch with this line
- should there be or should there preferably be
- the -- 

so, should there be one way meaning, is it obligatory to have one way or is it recommended to have one way? is it compulsory or just recommended?

the line does not leave us to guesses, it actually showed it with the --.

to preserve consistency, it should have been either
```
There should be one-- and preferably only one-- obvious way to do it.
```
or
```
There should be one --and preferably only one --obvious way to do it.
```
but it is both
```
There should be one-- and preferably only one --obvious way to do it.
```

As [David Goodger](https://www.codementor.io/@davidgoodger) mentionned, see the last line:

> Namespaces are one honking great idea -- let's do more of those!

Another way of using!

## Saying  Hi To The Import Itself

Let us take this line

```
Explicit is better than implicit.
```
but we import by
```python
import this
```
oxforddictionaries.com defines explicit as

_Stated clearly and in detail, leaving no room for confusion or doubt._

and implicit as

_Suggested though not directly expressed._

so, was the name and way of printing explicit or implicit?

## What The File Tell Us

here is the zen module source code in py3.7
```python
s = """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!"""

d = {}
for c in (65, 97):
    for i in range(26):
        d[chr(i+c)] = chr((i+13) % 26 + c)

print("".join([d.get(c, c) for c in s]))
```
and yet, in the zen we see

```
Readability counts.
```

very readable ...

## But Wait, There Are Exceptions

well, you are right, there are exceptions. yes maybe the zen file is an exception to the zen but wait ... the zen tells us

```
Special cases aren't special enough to break the rules.
```

ok then ... guess we've got the message

## Conclusion

the concluding words are the title of this article. pay attention to the word **too** .