Tech Corner

Python - First Impressions

For those of us who view programming as both art and science, there’s good news.  We’re not crazy; someone finally gets us.

Perl is dead

To the dismay of its proponents, Perl opportunities have diminished in recent years. So rather than go the way of the dinosaur, I took to Python as a matter of survival. This was six months ago.

My impressions thus far are positive. Yes, curly braces to denote scope are sorely missed, as is Perl’s autovivication (Google it). But Python lends itself to an expressiveness I did not expect. Plus a multi-processor worker pool can be implemented in a single line of code.

Java that!

From one neat freak to another - thank you

I never met the gentleman who invented Python, but I imagine Post-it-notes in his cubicle are aligned perfectly, indented when appropriate.

Form follows function

It’s a principle applied to modern architecture, product design and, one can argue, software development.  Python is well-written, beautiful, and close to effortless.  Readability is built into the language. To quote my manager, Python reads like prose.

Mirror, Mirror on the wall

Beauty is a notion central to Pythonic philosophy. If code looks ugly—i.e. overly verbose or nested—odds are the program logic is unnecessarily complex. Again, form follows function. Many idioms are available in the Python language to mitigate nesting and boilerplate coding.

Python newbies nervously submit their code for review, wondering if it’s Pythonic enough. Even seasoned pros will debate among themselves what it means to be Pythonic.

Less is more

Given multiple paths to the same destination, the Zen of Python emphasizes only one obvious way to get there. There is only one beauty. It is not subjective and open to interpretation.

Elegant solutions tend to look elegant; concise without being terse. The inverse of which is spaghetti. Those of us in the trenches know when a piece of legacy code has reached critical spaghetti mass, and when a total rewrite is more cost-effective than retrofitting new functionality.

How many lines of code have you written? Perhaps when interviewing for a Python opportunity the question should be restated—how many lines of code have you not written?