01.09
I am an unabashed fan of type safe, or at least, strongly typed language. I got my formative training in programming and computer science at Carnegie Mellon which has a department full of type theorists. I spent a lot of time playing with ML-family languages, NJ/SML in college and F# in the beginning of my professional career. One might, (okay, a few friends would definitely) say I’m a bit of a snob when it comes to programming languages.
And yet, more an more of the time when I come across an idea for a new project, I find myself reaching into my toolbox, not for F#, Ocaml, or Haskell but rather for python. It’s crept up on me little by little. When first picked up python I have to admit it was with a sense of mild distate. My wife works in biological science and needed a couple of cross-platform data wrangling scripts. None of the languages I knew well fit the bill and python seemed like an obvious choice, if only to branch out and learn something new. Early experiences with the language didn’t do much to change my opinion about python in general. Significant whitespace felt gross and inelegant. It felt like the language was trying desperately to hold my hand and protect me from myself. It felt clunky and awkward like a pair of borrowed shoes.
Little shoots of positives started creeping their way through the wall of my snobbery. It seemed like the library I needed was always available, ready to bolt in to my script. The mantra of “batteries included” seemed pretty built in to the standard library and I found that my “zero to done” time on these little side scripts plummeted. It was getting harder and harder to justify my distaste of the language and I started to get a feel for the places where it excels. Eventually my proficiency in the language improved and it started to bleed over into my fulltime work, where C# and Javascript rule the roost. For quick prototypes and one and done tasks I found myself reaching for python first. This was greatly magnified when I began doing more and more data analysis work and discovered the absolutely excellent scikit-learn. I’d say at this point python has pretty thoroughly won me over. It’s my goto language for lightweight services or prototyping tasks to be sure. There are just too many solidly written libraries for me to choose anything else. The “get things done” philosophy wins out over my ideal languages preferences
That isn’t to say the language doesn’t have its share of warts. The syntax is still ugly, and there are a few limitations in the lambda syntax I could do without. Also, I’ve yet to find a web library I really love, although I have been experimenting with Flask and it’s reasonable so far. I also fell victim to the dreaded global interpreter lock (GIL) and made the classic misunderstanding of how interacts with multithreaded code. I think this is more a matter of poor documentation but it bit me for a few hours threading CPU bound code before discovering this would result in zero improvement. This also means using additional cores on CPU bound tasks requires using clunky multiprocessing solutions which chew up memory, or dropping down into C which eliminates pythons productivity edge.
Still, despite these points of contention python has earned a place near the top of my toolbox. It’s become my trusted pair of channel locks I can always use to get the job done in a pinch, even if it’s rusty around the edges and a bit stiff to work with. I highly suggest you give it a whirl. You might end up pleasantly surprised.