2007-08-17

General update

For some reason I just felt like writing and nothing miraculous has happened in my personal life, which mean I will be scratching my writing itch here on my coding blog. Sorry PythonLand. =)

So Python 3.0a1 gets closer and closer. Lately Guido has been trying to stomp failing tests with various people. I personally fixed test_warnings to be re-entrant (__warningregistry__ being set on individual modules is evil!) today. Skip Montanaro (who has over 200 commits on me according to Ohloh) has been removing support for old OSs. I believe Eric Smith is the one implementing PEP 3101 (the new string formatting implementation). And with the Google sprint coming next week (which I am missing; first sprint I have missed since I joined python-dev) we might actually hit alpha before the month is out!

As for me, I have mostly been hacking on importlib. Once I got the API redesigned to make it easier to have different storage mechanisms for source code I felt hyper-motivated to code. Pretty much all week I have been re-implementing something like an importer or loader and then writing the unit tests the next night. At this point I have rewritten the extension and source file importers with tests. The extension module loader has been rewritten and the basic loading functionality is tested, but I just tossed in PEP 302 optional extension support and that is not tested. The source code loader has been rewritten but the methods needs for the source handler has not been implemented so it is not functional.

But boy has this rewrite simplified the code! I must have been on a slight functional programming kick when I first designed importlib as I was passing around a lot of objects throughout out the execution flow and then querying them for stuff. Now I have a base class and then provide the methods and attributes the base class needs to work. Much cleaner and easier to follow now.

I can't knock functional programming too much, though, as I am still passing key objects around. But I have just thought out more exactly what information can be provided up-front and what needs to be conditionally asked later. That has led to smaller APIs to implement with the trade-off of slightly large method parameters. But since the info is needed anyway, making the info parameters really is not a bad thing.

Overall I am very happy with how the rewrite is going. Granted I should have branched off my import_in_py directory in Python's sandbox, but it's not a big deal as I am just leaving the code in-place that I am making obsolete until I can do a complete switch-over. The real test in all of this, though, is how easy/hard rewriting zipimport is using the new API I came up with. If that turns out to not be overly painful then I think everyone should be happy with the basic support the package will provide for writing custom back-ends that use Python source/bytecode (I have stopped worrying about DSLs based on Python for now as I don't want to over-design and it can still be handled as the code that handles the source/bytecode dance is just a function that is set on the source loader).