Another great article appeared in the April issue of Python Magazine. This time it was written by Paul McGuire, author of pyparsing. The article is called Create your own Domain Specific Language in Python with imputil and pyparsing. It’s a fairly long article, but it walked through the steps of generating a language to describe state machines. The author used pyparsing to extend the Python language to add a state machine construct that is intermingled with real Python source code. He stored these extended source files as .pystate files instead of .py files, and then hooked the module import process with imputil to allow him to import .pystate files and have pyparsing automatically transform .pystate files into real python code.
There has been lots going on in my world for the past several years. The small company I was originally work at was bought out by a much larger one, who had a great deal of bureaucracy and a IP agreement saying they owned my brain. I tried to quit, but was convinced by my boss (whom I had known for a number of years) to hang around (looking back, even though things have turned out well in the end, I would have walked away). It was at that point, that I had stopped contributing to open source, for fear that the company may come back and say they had copyright on it.
I was browsing some announcements, and through a series of clicks, ran across Whoosh. Lucene is pretty recognized in the Java world as very flexible indexing and search framework. Whoosh appears to be doing that for the Python world. Occasionally, I’ve needed such a thing, but ended up writing my own lexer and indexer. I’ll have to keep this library in mind the next time a problem like that comes around.
My drive to and from work is anywhere from 20 minutes to 40 minutes, depending on the traffic (fortunately, it’s often much closer to 20 minutes). If you know me at all, then you know I hate to waste 20 minutes just driving. I need to feel like I’m doing something useful with that time. I often spend it listening to NPR, but I also spend quite a bit of the time listening to podcasts.