How learning Python made me a better C++ programmer
This post on the Raganwald blog spurred me to write about something I've been thinking about for a while: how learning Python has made me a better C++ programmer.
The short answer is, it convinced me to start using the boost libraries (and the Loki library). I'd seen these libraries before, and thought that they looked pretty neat, but that most of them looked too esoteric to be really practical.
But that was really a failure of imagination. Learning Python taught me the value of programming at a higher level. Things like using boost::signals to break up dependencies; boost::bind and boost::function to use functions as first-class objects; boost::foreach to separate iteration from the algorithm; boost::any for generic data types; and much more.
Kind of ironically, Python also taught me the value of using a functional programming style in C++. I say ironically because Python isn't a functional language (although it supports a functional programming style). It was reading the book Text Processing in Python (David Mertz) that showed me the value of this style; then as I got more into TDD, the value of this style became clearer.
Today, I couldn't imagine not programming at a higher level in C++. My C++ code is now shorter, easier to understand, and has fewer bugs and platform dependencies. But I might have never moved to this new level if Python hadn't shown me the way.