Writing forward-compatible software in Python

Python 3 is the fu­ture of Python. How­ev­er there might be a prob­lem in the com­mu­ni­ty if both Python 3 and 2 co­ex­ist. The for­mer one was great and bril­liant, but it is time to start writ­ing soft­ware in the new ver­sion in or­der to move to­wards new fea­tures and im­prove­ments.

Let’s start by the be­gin­ning. One of the rea­sons I al­ways pre­ferred Python over the rest of the pro­gram­ming lan­guages is be­cause it is more ad­vanced, mean­ing that in­clud­ed many con­cepts that oth­er lan­guages did not. For ex­am­ple, think of how ear­ly Python adopt­ed ideas like lamb­da func­tion­s, dy­nam­ic typ­ing, duck typ­ing, con­text man­ager­s, meta­class­es and so on, while oth­er tech­nolo­gies (name­ly Java, C++ for ex­am­ple 1) were still us­ing da­ta struc­tures and call­ing them “ob­ject­s”. Python has al­ways been many steps ahead.

Great news are that this is no over: Python is still im­prov­ing at a fast pace. And that is pre­cise­ly the is­sue with Python 3. As a re­sult of that evo­lu­tion, the new ver­sion of Python must change some of its in­ter­nals in or­der to prop­er­ly im­ple­ment new fea­tures, and this is what lead it to be in­com­pat­i­ble with ear­li­er ver­sion­s, which should not be a prob­lem. But it seems it is.

Some de­vel­op­ers do not like the new re­lease, and they are not keen on mi­grat­ing the code base. They ar­gue that Python 3 “is wrong” be­cause it is not back­wards com­pat­i­ble, but my ques­tion here is why are we think­ing back­wards in­stead of for­wards. A pro­gram­ming lan­guage as a mod­el or con­cep­t, must evolve, im­prove, so we should be think­ing on the fu­ture of the lan­guage rather that on its past. I think they are miss­ing the new ideas, the way Python is chang­ing in or­der to in­cor­po­rate more ef­fi­cient mech­a­nism­s. Per­haps this time, the leap was too big.

I think the best for the lan­guage is to adopt its new ver­sion, and do not think of it as a dif­fer­ent one. There­fore, when we say “Python”, it should be un­der­stood that we are talk­ing about just one sin­gle ver­sion.

1

At the time of this writ­ing just the lat­est ver­sion of Ja­va in­cor­po­rat­ed lamb­da ex­pres­sion­s, which have been avail­able in Python for many years.