Hit +1

Hey guys!! If you like this blog please hit the +1 button on the left... Its for a contest. The more number of hits, better the chance of us winning!

Wednesday 23 October 2013

The Zen of Python

I would start off with clarifying a popular misconception. The Python programming language does not in any manner associate itself with the reptile python. Nor does it draw inspiration from the viscous beast. The name was inspired by the 'Monty Python' comic series, which they say is a popular comic series in the West. (Trust me, this was the first time I knew a comic by this name existed. 'Monty Python' seems a very strange name for a comic though). "Monty Python was a British surreal comedy group that created Monty Python's Flying Circus, a British television comedy sketch show that first aired on the BBC on 5 October 1969" quotes Wikipedia. Oh yes, 1969! Way before our generation to be precise. Lets leave it at that folks.
We'll just dive into Python, the programming language.


Python is the "most powerful language you can still read".

This statement was made by Paul F.Dubois who's one of these elite persons in the world of computers. His profile says PhD from University of California and a couple of awards for contributions to the American physics community. Very impressing indeed! Well I don't know what he's doing right now, but his words above make two important facts about Python language. One thing is about its power and the other is about its readability. 
Python has a lot of power in terms of flexibility, objected-oriented-programming, libraries and so on! And yes, it had tons and tons of libraries, like literally! Doesn't that make writing code easier for you? Well, if there are code blocks for everything all you got to do is to use them wisely.
The second part is about its readability. Whenever you see a large chunk of code, you get intimidated don't you? For some of us, its plain Greek and Latin. Well like Dubois puts it, its the language you can still read as in its the most friendly language. For this very reason, many people refer Python to as a "great first language". It's a clear, simple, versatile language with well thought out syntax and has a myriad of libraries that makes it so appealing. The possibilities that one can imagine with Python is infinite.


Now that we're well briefed, let the Zen of Python reveal itself!

zen_python
The Zen

There are two words I would like to say to you. They are "import this". When you type these two words and hit Enter in a Python interpreter a set of quotes pops up. As it says, its by Tim Peters. Must've been a great person, this "Tim". Frankly speaking, I do not understand all these statements, but some of these few simple but powerful lines have changed the way I think. They said these are the founding guidelines of the Python community, but I say these are the guidelines for life.

"Simple, yet powerful",the whole ideology of Python.

Number ONE! Beautiful is better than ugly.

Woah! Stop your thoughts right there. I wasn't talking about physical appearances of guys and girls. Its the inner-beauty I'm talking about. The innate uniqueness that is associated with each one of us is truly remarkable. Aren't we all beautiful in the eyes of our creator? Nature is one of the best examples. Do flowers and trees have captions on top of them and a "Like" button at the end? They are all beautiful from the *inside*.  Same with code!

Number TWO! Explicit is better than implicit.

Python gives an easy solution to all of our relationship-issues. Ain't it smart? Just open yourself and dance in the rain, my friend. Don't be a closed book. Let your code reach the people. And make them understand, so that they can write on their own.

Number THREE! Simple is better than complex, Complex is better than complicated. 


How true! What have I been telling you all night? Keep it simple, Keep it straight. Same with code, same with life. Enough said, lets move on. 

Number FOUR! Readability counts.

Oh yes, this is the first lesson for any programmer. Unless someone understands the code you write, your code really does not help. That's the sad truth and I know how hard it is to do this. My suggestions would be to keep this fact at the back of your mind always, "The computer is not just a machine, but a person." It helps me, I don't know if it'll help you. And from a life perspective, you should express your thoughts! Does not matter if its correct or wrong. Go on top of a mountain and shout out, loud!

Number FIVE! Special cases aren't special enough to break the rules.

This is kind of tricky. Well, we all do bend rules, grease it and suit it to ourselves. But each time we do that, we're cheating ourselves. In real life you can't say, "I don't care if your baap(father) is the CM or PM ".  But you sure can do one thing. Teach that "special case" a lesson. Be smart, don't just code away.

Number SIX! In the face of ambiguity, refuse the temptation to guess.

There comes a quick-fix answer to all our Multiple Choice Questions(MCQ). I don't say no to instincts, but just give a thought if there's a logical explanation to the instinct. Think harder, code more to code less.

Number SEVEN! There should be one-- and preferably only one --obvious way to do it.

Here's where Python shows its "cool dude" attitude. For a problem, there should be one obvious way to do it right? It might be a little hasty and you might even mess up, but what's life without all that? Make mistakes, learn from them, un-learn, repeat the process all over! You have one life, live it.

Number EIGHT! 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.

Doesn't this say it all? Take an example of arranging the furniture at your new home. You put in all the cupboards and cabinets first, then bring in the sofas and chairs. What if you do it the other way round? Bad idea! So whenever you think of ideas think about their practicality as well. 

And lastly : 

NUMBER NINE!  Now is better than never.
Although never is often better than *right now*.

Time is of paramount importance, and those who realize it are smart!(unlike me). Somethings are to be done right now, some never. I don't get it when people say that there's a right time for everything. All  I know is that the clock's ticking. You are the master of your life! Choose wisely. 

Summing up,   

Antigravity, yeah!

PS: I've not put in the Python Logo cause I've to still figure which color's on top.
Disclaimer: To see not so ambitious Python projects click here.

No comments:

Post a Comment