The first programming language I coded in is QuickBasic. I loved the simplicity and especially the IDE. It made things simple for a starter. Later I discovered Visual Basic which extended the same simplicity and added the “Visual” element with a splendid editor for GUI.
In between I did some projects using Java, C#, C, C++. None of these impressed me too much. I hated Java’s imposition of stiff rules and it’s dogged adherence to “everything in a class” attitude. C# was better. C++ just turned me off because of the monster it is. I did not like C at all because of its total lack of automated memory handling (like GC). I’ve been doing a lot of coding in C now-a-days as part of my job and I must admit that I like it a lot for its simplicity in primitives and promise of “closeness to hardware” and hence the predictability and performance.
I did a small part of my final year project using Python. However, for some unfathomable reason, Python did not impress me at all then. When I started working at Veveo I used Python for a project and got hooked. It’s simplicity and “readability” got me. The power of wielding this tool got me drunk
Python was designed from the beginning to be a “easy to read” language. Most, if not all, of the syntax is intuitive. The indentation adds to the readability aspect. The policy of “only one way to do a thing” does wonders for readability. Everyone does a certain thing only the “one” way. If you are wondering why the heck I am talking so much about readability, you should consider the fact that an average programmer spends most of his time “reading” code. You have to read your code after you’ve just written it. You’ve to read your code the next day when you resume work. You’ve to read your code the moment a bug is found. You have to read your code when someone asks you how some aspect of it works a couple of months later. You’ve have to read your code when making a teeny-weeny feature addition. I just cannot emphasize enough how much time is spent is just reading. There have been times when I would spend a whole day just reading code and finally making “a single line of code change” at the end of the day!
So there it is. Python makes it possible to write readable code and that does wonders to programmer productivity. Maintaining your code becomes easier. Understanding your collegues code becomes easier and most of all understanding code written by someone across the world becomes easier – so you can start reusing components more quickly and with more confidence than ever before.
I simply love Python.
You must be wondering where I am taking this discussion… because the title says something about a Python being abused. Who is abusing the Python anyway?
I’ve noticed how newbies code in Python and found it particulary intriguing. What is interesting here is that every person comes from a certain programming background and are used to doing things in a certain way. When they are thrown into a situation where they have to learn a new language and write some code in it, they invariably apply the vast experience they have in their language of choice
I’ve had the oppurtunity of observing people from Java, C, Perl, VB (yes, Perl) backgrounds writing code in Python. The Java guys stress test multiple inhertitance in Python and bring the much cherished “everything in a class” practice to the Python. The C guys who are more often than not obsessed with performace and optimization put their brains to work and implement a strcpy using a “for loop” and insist on doing a “shift” instead of “division/multiplication”. The Perl guys just don’t seem to like the alphanumerals. They craft Python code with ingenious application making it look very concise. The more characters in one line the better the code. The more non-alphanumerals the better coder you are. That’s the way of the “Perl’ies”. The VB guys languish for a while complaining constantly about the lack of a proper IDE and after trying out various Python editors, decide to call it quits and go home to comfortable VB. I know, I know ….. I was a VB guy too and I did search for IDE’s too … But then I found VIM and everything was good
I’ve had the good (snigger) fortune of maintaining some of these brilliant artifacts and had my share of nightmares and laugh-outs. I thought I had seen it all, until I saw something today. I told myself — “Never underestimate a brilliant C programmer who has found exec and eval in Python” … Yes, you can quote me on this
guido = "is speechless" larry = "went nuts" sergey = "has seen it all now" ... ... for idx in ['guido','larry','sergey']: idxv=eval(idx) if(not idxv and dd.has_key(idx)): idxv='%s="%s"' %(idx,dd[idx]) exec(idxv) ... ...
No….. I don’t think I’ve seen it all….