The hidden "Zen" in Python"

Source: Internet
Author: User

In the lib directory of python, There Is A: this. py, which actually hides a poem. The source code is as follows:
Copy codeThe Code is as follows: 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 orfgchevgl.
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])

Output result: (translated from IT Plato)
 Copy codeThe Code is as follows: The Zen of Python, by Tim Peters
Zen of Python by Tim Peter

Beautiful is better than uugly.
Beautiful is better than ugly.
Explicit is better than implicit.
Explicit is better than implicit.
Simple is better than complex.
Simplicity is better than complexity.
Complex is better than complicated.
Complexity is better than annoying locks.
Flat is better than nested.
Straight is better than nested.
Sparse is better than dense.
Sparse is better than closeness.
Readability counts.
Focus on readability.
Special cases aren't special enough to break the rules.
Special rules cannot be violated,
Although practicality beats purity.
Although it is more practical than pure.
Errors shoshould never pass silently.
Errors should not be silent,
Unless explicitly silenced.
Unless otherwise specified.
In the face of ambiguity, refuse the temptation to guess.
In the face of Blurred faces, he refused to induce speculation.
There shoshould be one -- and preferably only one -- obvious way to do it.
There should be one -- and it is best to have only one obvious method to do this.
Although that way may not be obvious at first unless you're Dutch.
Although this method is not obvious, unless you are the first Dutch.
Now is better than never.
At present, it is always better than always.
Although never is often better than * right * now.
Although it is never better than immediate.
If the implementation is hard to explain, it's a bad idea.
If the implementation is hard to explain, this is a bad idea.
If the implementation is easy to explain, it may be a good 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!
Namespace is a great idea for people to scream-we should do more in that respect!
The author is very "wet !!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.