python 2.7

It’s been awhile

It has been quite a while since I last wrote about anything. It has been hard finding a topic that motivated me enough to write about.

Python 2 EoL

Python 2 has had a long run, longer than it should have. On January 1, 2020, Python 2 reached EoL after almost 20 years of support. Version 2 was originally released in October 2000. I started using it around that time. The first python book I bought was written for version 2.1. When Python 3 was first released in December of 2008, it didn’t go so well. Part of Python’s power is the large number of community packages, however this also proved to slow the adaptation of Python 3 as backwards compatibility was broken. Python 3.5, released in September 2015, was the first time that 3.x shined and about that time the number of packages supporting Python 3 vs Python 2 started to shift. Recently, most popular packages have finally dropped all support for Python 2. I hope you have transitioned to version 3.

More than a destination

Programming is more than a destination. Care about the code you right. Just because code works today doesn’t mean it always will. Complex, bad, or hard-to-understand implementations are a permanent cost.

YAGNI

YAGNI – Your not going to need it. Related to the previous section, adding complexity because you think you will need something is not good. Adding complexity means that you have made change more time consuming, more code to review, understand, change, and test.

Posted by Chad Dotson in Doing Things Better, Programming, Software Engineering

Odd Behavior in Python 2.7

I was tinkering around with replacing the print statement with the print function in a Python 2 script when I ran across this peculiar oddity.

Notice that sequence is just importing the future print function as different names in each iteration.  The oddity is that the first import fails but the third (which is exactly the same) succeeds after performing the second.

** Note: I don’t know if replacing print with the print from the futures module is a wise thing to do.  I was simply using it while trying out some code. **

Versions tested: Python 2.7.10 (OSX), Python 2.7.6 (Ubuntu 14.04).

Posted by Chad Dotson in Programming, 0 comments