Wednesday, January 2, 2008

Why I love Python

When I met an old friend of mine, he inquired about my work. I replied, rather gushed out, that it was wonderful 'cause I was working in a dynamic language called python. He gave me a quizzical look and asked how could you call work is good because the language is good, for after all language was just the tool. I listed out some of the features of python but somehow I felt it was not sufficient reason. Then we drifted on to to other topics.

Later, I thought back on the issue. Why I fell in love with Python is almost the story of my life. I got introduced to computers in my third grade. That was a time when computers were still rare in schools almost non-existent in homes. Then we just tried executing basic programs already created by our teachers or play games. One such program would get your name as input and print "Hello `name`" as output. I was fascinated! The next two years we spent learning who Charles Babbage was and what ENIAC was. In 5th and 6th grade I finally got to write BASIC programs. We wrote programs to calculate squares, students marks and generate multiplication tables. Normal though it seems now, I was thrilled! With a few lines of instructions, I could make the computer calculate almost anything! I took special pride in the fact that I could express my solution much better than most of my class mates. I had decided I'm going to work with computers in the future.

Then I had to change schools. My new school did not have computer classes until 11th.
When I finally got to go near computers, we started at BASIC and went on to Visual Basic. Things progressed and I got an opportunity do my B.Tech in Information Technology in a prestigious Institution. In our first sem, we had a C course which ended a disaster due to various tragicomic reasons. In our second sem, we got a wonderful Prof Mr. V. Ramachandran, who in a very short span of time, taught us C, C++ and Java, carefully ensuring we understood the underlying design, its implications and relative differences. We liked programming in C. But C++ seemed to be design filled with complications for the sake of complication. Java was relatively better. Most of our projects were done in C++ or Java. So either we spent a lot of time debugging or doing a tour of referencing to write a line of code. Some where in the process, the focus of programming shifted from understanding and solving the problem to getting constructs right and searching for the right class and method. And with that went most of the joy in programming. I still relished classes that dealt with logic like Data structures, networks, distributed OSes but I started drifting away slowly from programming.


Then I joined this cool startup that promised to bring everything under the sun to your handheld. And they used python. That was were I saw Python for the first time and It was love at first sight. The zen of Python captured my heart and all the joy of programming came back to me. Now I did not have to worry unnecessarily abt pointers or obscure constructs and factories. (Don't get me wrong, I do respect C and C++'s ability to get below the hood, but they are just an overkill for most apps ) I could spend my efforts on finding an efficient solution and as and when I reorganize my solution, my code could be reorganized with minimal effort. The coded solutions were mostly optimal but in some cases were optimization was desired, a simple change in construct would suffice. In only one situation, we had to do a C implementation for the bottleneck module.

I have been working for two years now. Python has helped me improve my coding discipline and productivity a lot. I am able to appreciate the value of Linux and vim better. It has also made me more receptive towards new languages.

Thank you, Python!

1 comment:

Anonymous said...

This is great info to know.