The first book I read on management was Peopleware. Its premise was simple: managers should guide and enable their employees, who will do wonderful job just by virtue of being smart, wonderful people in an autonomous, wonderful environment. It was a horrible failure; more due to me and to the team being young and inexperienced than to Peopleware being wrong, but still—it made me naturally gravitate towards the opposite school of thought, where I discovered the Mythical Man-Month.
“Whereas Peopleware says managers should be like kindergarten teachers,” I would passionately explain, indulging myself with a dash of demagogy, “The Mythical Man Month says they’re surgeons. I mean, there’s a reason you were put in charge of the project—you know how to do it best, and the rest of the team is there to assist you in making it happen, not the other way around.” …
Finally, we’ve arrived at modules and packages: the last digivolve of Python. At first, it might surprise you to hear there’s a lot to say about them: after all, in C++,
#include is just a preprocessor directive that literally copies over the header, and in Java,
import is just a hint on how to link the bytecode. But in Python, like always, a module is an object—and as always, it opens up a new horizon of possibilities.
Let’s start with the basics:
import. Already, there are quite a few different objects it returns:
>>> import sys
We’re nearing the end of our journey: from stuff as basic as scopes, conditions and loops, through objects, classes and metaclasses — we’re ready to talk about our final topic: modules and packages. Before we do, I’d like to take a moment to address all the object-oriented stuff that I skipped, whether because it didn’t fit the narrative, or I just didn’t want to get bogged down by (even more) details.
There’s a very important special method I skipped:
__hash__. It’s pretty basic on one hand, and a bit complicated on the other, so it didn’t fit in any of the sections. …