- Python Magazine published my article "Using Dependency Injection in Python" in their August issue. Doug Hellman saw my blog entry about DI when I was switching web hosting and managed to repost old stuff to Planet Python, contacted me to ask if I wanted to expand on it a bit, I said yes, and now I've been published. Which is nice. I basically argue in the article that dependency injection is a good idea and you don't need to buy into a framework to get many of the benefits and provide some examples on how to do it. Which seems kind of apropos, seeing as there's yet another new contestant in that area.
- I was hacking on something I wrote in Python recently and was doing it in a pretty heavily dependency injected manner, writing tests as I was going along. It came to me that one really basic, really nice thing about Python that isn't discussed all that much is that callables are duck typed and there are multiple choices on how to implement them. When you write a function that takes as a parameter something it calls to acquire values it doesn't have to care what the thing it's been given actually is. It can be a function, a callable, a bound method, a constructor, a lambda expression or even a generator. The caller doesn't have to care. It's not a language feature that's easy to fit in a bullet point or to appreciate without using it, but it is useful.
- I was excited to see class decorators are coming in Python 2.6. Then I realized I can't remember what I wanted to use them for when I was really frustrated by their absence, but still, it's good. I always found their absence rather puzzling.
18 September 2008