Archive
[NSFW] Jennifer Lawrence enjoys Python too
How automation works in reality
Python is an excellent choice if you want to automate a task. But how does automation actually work?

http://xkcd.com/1319/
import this
The easter egg “import this” is well-known. However, what is “this.s“?
>>> 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! >>> >>> print this.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! >>>
Well, this.s is the rot13 encoded version of the original text. Here is how to decode it:
# Python 2
>>> print this.s.decode("rot13")
# Python 3
>>> import codecs
>>> print(codecs.decode(this.s, 'rot-13'))
Found @reddit.
Python vs Java in relation to logos
Emanuel Couto explains the difference between Python and Java, comparing the logos of the two languages:
“I read almost all comments and I there is one point that all of you missed! The logo is important for productivity!
The Python logo is obviously a snake. The name of the language, however, was based on Monty Python. So what this means is that you are going to have good laughs when the python bytes you. Specially when the code is too long to debug or understand.
The Java logo is a cup of coffee. What this means is that you are going to need coffee when programming in Java or you will fall asleep. In fact you are going to need loads of coffee when your code is near production stage. BTW I don’t drink coffee, so my job is twice as hard.
Jython is when you give coffee to a snake. Jython users are people that drank toomuch coffee and over time it doesn’t have any effect anymore. Since the python needs to sleep, the solution is giving coffee so that Java programmers can also have laughs at late hours of the day.
And that folks is a true story.” (source)
Get yourself analyzed on GitHub
If you have a GitHub account, you can get yourself analyzed with The Open Source Report Card.
Here is my report for instance. Scroll down to the bottom and try it with your username.
It will also list users whose activity is similar to yours.
The webbrowser module uses xdg-open
With the webbrowser module you can open webpages in your browser. But how does it work?
Well, under Linux it uses xdg-open. I figured it out accidentally. Start the python shell and try this:
>>> import webbrowser
>>> webbrowser.open_new_tab('')
You will get the usage message of xdg-open :)
@grammer_man is the best troll
“…decided to write a little twitter bot. There he is above. His name is Grammer_Man and he corrects other twitter users’ misspellings, using data scraped from these Wikipedia pages. … You can see who’s responding at the moment by searching for @grammer_man.” (aengus)
It is worth checking out the reactions of the victims. Most of them have no idea that they reply to a bot :))))
Antigravity DOES work!
Today I came across the funny antigravity cartoon at xkcd again. I said to myself: “Well, let’s give it a try.” I was amazed to see that it really works! Try it yourself:
$ python Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import antigravity >>>
These guys were able to put it in the standard library :) Python is really fun, I discover that every day.
I won’t link the image, you must try it yourself.


You must be logged in to post a comment.