Geek; Programmer; Pythonista; FOSS enthusiast, evangelist and contributor; Melange developer; opinionated about programming languages; crazy about cars and air-planes; choosy in watching movies; loves Bangalore, San Francisco and Southern California; and most importantly addicted to coffee!
Madhusudan C.S.
map (thoughts) => words;   reduce (words) => this;
Oct. 23, 2008, 2:27 p.m.

   This is my first post related to Python. For those who did not know what Python is, stop guessing here, its neither the Snake nor the BBC Comedy Series. Its the Coolest Programming Language I have come across till now, whose name is inspired by Monty Python skit which I just mentioned above. I will try to post about any interesting things I stumble upon as I learn more and more about this really awesome language which makes the lives of developers unbelievably easy. Most of my posts, at least the ones in the near future will be targeted to those who have absolutely no idea about Python or those who know about it but thinking whether its worth learning it or avoiding it for some reason (any such reason according to me becomes meaningless once you learn Python, at least it happened so to me. I still feel how foolish I was all these days avoiding to learn Python just because I did not want to copy my other friends who were learning it, height of stupidity I would say. I still feel I would have been much more foolish if I had not started learning it now at least). If you are thinking why I am not targeting those who already know it, its simple because what I write here in the near future will be mostly known to those who know the basics of Python. But if you know Python well and if you are still interested to read my posts, you are welcome, Thanks a lot for your interests. But Warning to such people: These posts are mostly to convince those who don't know Python to learn it and make their life better. Period to the intro ;-)

   From past many months I have been following the development of Python 3.0 (on mailing lists, blog posts, news and other sources) with the goal of contributing to the Python community. But haven't been able to do so because of the speed at which the work happens there. Its so fast that, it became extremely difficult for the first timers like me to contribute some code to the language itself or so I felt. Sorry I am not discouraging you from contributing to Python, but what I am trying to do is just convince you that, Python is the fastest growing language I have come across. The developers are very welcoming if someone wants to contribute. So if you are vigorously pursuing to contribute to the language itself I am sure you are respected the most by the community. One important note before we go any further is that Python 3.0 is now in Release Candidate phase and the final is scheduled to be released in December.

   Python 3.0 is one of the biggest change to the language ever being made. In what way? - It breaks almost all the existing Python code!?!?!? It simply means that if you have your Software running on any of the existing versions of Python, i.e Python 2.x series such as 2.4, 2.5.2 or so you cannot simply run the code on Python 3.0. So there is no backwards compatibility in Python 3.0. The first question that flashes to everyone's mind is - WTF??? I too thought the same when I heard about this. But as the days progressed, it simply became obvious to me why it is so. These things should be heard from or read from Guido van Rossum's (Creator of Python, affectionately called as BDFL - Benevolent Dictator For Life by the Python community. This name is inspired by one of the lead roles of Monty Python skit) writings itself. But anyways let me try to summarize what I have understood, and try to convince you why this change was necessary and what it might mean to the whole community?

Simply to put in Guido's words,

1. "Open Source needs to move or die"
2. "The motivation for 3.0 was to have one specific event where we did as much of the backward incompatibility all at once and to give the language a better foundation for going forward."

   He also says that Python has grown out of bounds and it has reached the heights he had never dreamt of. All these have made the development of Python big and bloated. But as one of the points in Zen of Python goes (Zen of Python [2]. To see all the 19 points, in the Python interpreter type "import this"), "Simple is better than Complex". For those who don't know what Zen of Python is its a set of 19 points which best describes what has made Python what it is today. In the sense, we can call it "The vision of Python". So Python's development and this point have slightly become contradictory these days. So there is a need for the correction.

   But what this means? What this means to the Python community and the existing Python programmers and Softwares that use Python in general? As one of the Python developers point it out, Python 3.0 may be the Windows Vista of the Python world, in the sense programmers may not simply find any reasons to switch to it. May be true. But I personally don't quite agree (probably because I love Python so much). Also I am confident that Python is not so very foolish enough and business minded to make such trivial blunders! (Sorry but I said the fact, I am really sorry if you are a Vista fan, but I can't help keeping the fact a secret). More over its Open Source!!! So what? It means it can correct from its mistakes rapidly than any other proprietary projects since the development process is transparent and any one can contribute their invaluable suggestions to correct the mistakes if at all there are any.

   What's more interesting is that, Python community has already proved what I have said above. First of all it makes two things very clear.

1. If you are a new Python developer starting today, you must start with Python 3.0 rather than 2.x.
2. If you already have a Python code, please don't bump it to Python 3.0 all of a sudden in one go.

If you are thinking, "Ouch, what on earth made them develop Python 3.0 then?". The answer is simple. They are just asking you not to be hasty, not that you should not make the transition at all. They are asking you to think patiently and thoroughly. Eventually almost all the code will be migrated to Python 3.0 but there is no urgency. Python community thinks it may take anywhere around 3-5 years for the complete transition. So you can do it cool-ly, as and when you feel it is necessary.

   To streamline the transition from 2.x to 3.x Python community has come out with two interesting tools. As the community describes -

1. Python 2.6 was released with an ultimate goal of making this transition smoother. First thing to do while migrating to 3.0 is to run all the code in Python 2.6. Python 2.6 is really backwards compatible with other Python 2.x releases. It means it doesn't break any existing code. But only thing it does is simple, it generates warning for all the code that is incompatible with Python 3.0 as deprecated. This clearly means that if you are willing to migrate to Python 3.0 you must remove all these warnings, i.e change the code not to generate any of these warnings. If you do this, voila! Your code is Python 3.0 ready. I think this really makes sense.
2. Run the tool called 2to3 which has been exclusively developed for making the transition smoother. It translates all the Python 2.6 code to Python 3.0. Its an automated tool and one of the coolest things I have heard of. It seems from what I read it cannot do all the translations as of now, but most of them are converted automatically to Python 3.0 without much of your intervention, but few things will still be broken, which you need to do manually. But I am very sure this tool also is still under development and is bound to improve.

I think this is a good proof.

   These kinds of tools are rarely found and rarely being developed, with the goal of just helping the programmers do the transition from one version to another. Hats off to Python developers and the entire community. If you are not still convinced to use Python, this should at least should strike that Python rocks!

   Finally before I end this post, I just learnt today that Python 3.0 development started way back in 2000!!! Yes indeed! They have taken 8 years to do this release. One must realize the amount of work that must have gone behind it. No, they are still following the "Release early, Release often" principle, simply because Python 3.0 was not the part of main stream development. Main stream development was still happening on Python 2.x side which was being released often. Also there were Alpha, Beta and RC releases of Python 3.0 which were nothing but the results of release early principle. And of course the entire process of development was transparent. So I think Python 3.0 will not fail (if you are thinking on lines of Vista :P ). But one question that strikes to me is, if they have taken 8 long years of all the pain and trouble to change the language itself to Python 3.0, how long might other developers who use Python take to bump up their code base from Python 2.x to 3.x? Obviously if they don't find the absolute need for doing so, the process becomes much slower. There are projects like Blender (3D modeling Software), Page DNA among others which have tens to hundreds of thousands of lines of Python code. Do they really care to migrate? They may think if its not worth all the trouble and pain. If at all they migrate it, it might take many more years than what the Python developers have estimated unless something really interesting happens on Python 3.x side of development. But what really happens is still a big question, to which we have to wait and watch with patience to get the right answer. I mean, as many of formula stories end, "Only Time Answers This Question" ;-)

- Thanks and regards,

comments powered by Disqus