jump to navigation

Overcoming the fear of Python January 16, 2008

Posted by xk0der in : Programming , add a comment

As all C, C++ and Perl devotees, I too looked upon Python with apprehension. Python? What? I asked. The very idea of white-spaces being part of syntax gave me jitters and I convulsed with disgust. Why Python? Perl can do it. OOP? Perl has it … errm .. Kind of.

After reading numerous articles about python by putting the search terms “I hate pyton“, “python will die” and the like, I started getting a grasp of differences and likeness between python and other languages. One thing more I learned was, never be judgmental about a programming language if you have not used it. So after traversing threads at various forums related to “Love Python” and “Hate Python” I started understanding the various mumbo-jubo related to python. And then the thought occured to me, let’s give it a try. I downloaded python on my Windows XP machine at home and Vim for windows. Then jumped right into coding a problem that was asked to me in an interview. It was a design problem actually, but nevertheless a design can be implemented :) .

Within minutes I was automatically indenting code as I used to with C,C++ or Perl (or other free form languages I had used, for that matter). So the frown over mandatory white-spaces soon turned into a smile. And by the time I could realize I was finished creating a four road junction traffic simulator. I did searched the net for some reference, but the best thing was I just looked at the example and understood what it was, no reading what the code does or will do. Other syntax came so naturally that I didn’t even had to look online. That is I guess the beauty of Python.

In around half an hour or so, I had a complete running program in Python, using classes, random number, lists and other subtle features. The code was so readable, I thought, do I need some of those comments I’ve put in there? Some were required. But most of the time the code was itself very much self-explanatory.

Later I booted my laptop (it has FC7 installed) and copied the code on my Lappy. Python comes bundled with FC7 so I straight-away executed the code. Wow! … Its faster than windows .. Ha ha … yes this is what I noticed. Then I tinkered a bit more with the code, optimizing some things and learning new stuff in the process. Overall I enjoyed my first step into Python, very much.

I’m not going to shun C,C++ or Perl for that matter. For quick one-liners Perl is still the best. My domain is embedded systems and Linux Kernel programming so C and C++ are essential. But this discovery about Python has really give me an option. Option to create large and manageable programs in less time. They say in the python community, You spend more time solving the problem as you code and less time worrying about the language and its syntax. I Agree!

Like this post?