Python hidden love and hate

Posted: January 1, 2009 in general
Tags: , ,

This is just my little hate/love affair with python. This post will be a bit chaotic but ohwell…

Well when I first read about python my inmediate reaction was: HATE HATE HATE. This reaction was only triggered because of one reason: indentation. This kept going on for a while until I finally decided to try python out and create my opinion based on using the language instead of prejudices. I’ll explain what the word ‘hidden’ does in the title of this blog posting later on.

The first thing to watch our for when starting with python is the following:

I mean I’ve heard that python is sexy but I don’t think they ment a full blown porn website.

After coding in python for a while (read 2 days) my reaction started to turn from: HATE HATE HATE into HATE LOVE HATE LOVE LOVE. So let me explain my hate towards python which for the moment beeing is only because of the indentation.

Why on earth have a language which forces indentation? I mean all normal IDE environments nowadays have normal code formatting. It’s like create your own personal profile. Then just select the sourcecode and hit format. BANG there it is, from bad indented sourcecode to your own favorite style.

So what part of python turned my hate reaction into a hate/love one? It’s simplicity. I mean it’s just so relaxed to do so much with so little. As an example check out the following code to print out all files in a directory tree.


import os

if __name__ == "__main__":
    for root,dirs,files in os.walk('C:\\'):
        for file in files:
            print file

In some other languages I usually code, it’s more lines of code to achieve exactly the same.  Now why does the title of this blog posting include the word ‘hidden’, because (yeah at first I didn’t believe it) there are some funky ass python script(or just ideas which could be build with python) out there.

Check the following links on covert channel techniques and funky tools which use python for scripting.

Advertisements
Comments
  1. verboze says:

    Haha, I concur with the HATE part atm. I heard great things about python, and I want to give it a try, but man… Forced indentation? I saw some (poorly written?) python code where indentation was columns long (nested IF/ELSE)! However, XBMC uses it, so I guess I’ll have to set aside my qualms, give it a go and see…

  2. […] blogged about. Some of you might wonder why I choose to support python, seeing that I previously wrote about it and I hate/loved it. Well because afaik it’s the easiest language to embed inside C. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s