2006-10-05

Rewriting import in Python source

Yes, I know I said I was going to implement phase 2 of PEP 302 in C. Then a bunch of people came out and said they thought it would be easier to do in Python. So I caved in and decided to spend my work time *and* personal time on this project so as to not make my supervisor a sponsor of Python work instead of a sponsor of my research. Paul Moore is also currently helping out to help mitigate the possible extra cost of doing this extra work of reimplementing the entire import machinery in Python instead of just refactoring it.

The work is initially being done in the sandbox in the import_in_py directory. Once that is fully working then it will be moved to the pep302_phase2 branch and Python will get tweaked to use the Python implementation. Assuming performance is not utter crap (which I doubt since this stuff is so I/O bound) or I can't figure out the booststrapping issue (which I really doubt since I have been contemplating this for a while) then it should hopefully end up in the trunk.

It should also help lead to a PEP for how to improve import for Py3K. Most likely there will be a more locked down specification of how imports should work and a cleanup of the semantics.

Either way it is really nice to be writing some Python code. I have been so deep in the core that I have been breathing C for months now (can't remember the last major piece of Python code that I wrote was).